| 1 | // Copyright (C) 2017 Ford Motor Company |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QREMOTEOBJECTS_ABSTRACTITEMMODELREPLICA_H |
| 5 | #define QREMOTEOBJECTS_ABSTRACTITEMMODELREPLICA_H |
| 6 | |
| 7 | #include <QtRemoteObjects/qtremoteobjectglobal.h> |
| 8 | |
| 9 | #include <QtCore/qabstractitemmodel.h> |
| 10 | #include <QtCore/qitemselectionmodel.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QAbstractItemModelReplicaImplementation; |
| 15 | |
| 16 | class Q_REMOTEOBJECTS_EXPORT QAbstractItemModelReplica : public QAbstractItemModel |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | public: |
| 20 | ~QAbstractItemModelReplica() override; |
| 21 | |
| 22 | QItemSelectionModel* selectionModel() const; |
| 23 | |
| 24 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final; |
| 25 | void multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const override; |
| 26 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; |
| 27 | QModelIndex parent(const QModelIndex & index) const override; |
| 28 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override; |
| 29 | bool hasChildren(const QModelIndex & parent = QModelIndex()) const override; |
| 30 | int rowCount(const QModelIndex & parent = QModelIndex()) const override; |
| 31 | int columnCount(const QModelIndex & parent = QModelIndex()) const override; |
| 32 | QVariant (int section, Qt::Orientation orientation, int role) const override; |
| 33 | Qt::ItemFlags flags(const QModelIndex &index) const override; |
| 34 | QList<int> availableRoles() const; |
| 35 | QHash<int, QByteArray> roleNames() const override; |
| 36 | |
| 37 | bool isInitialized() const; |
| 38 | bool hasData(const QModelIndex &index, int role) const; |
| 39 | |
| 40 | size_t rootCacheSize() const; |
| 41 | void setRootCacheSize(size_t rootCacheSize); |
| 42 | |
| 43 | Q_SIGNALS: |
| 44 | void initialized(); |
| 45 | |
| 46 | private: |
| 47 | explicit QAbstractItemModelReplica(QAbstractItemModelReplicaImplementation *rep, QtRemoteObjects::InitialAction action, const QList<int> &rolesHint); |
| 48 | QScopedPointer<QAbstractItemModelReplicaImplementation> d; |
| 49 | friend class QAbstractItemModelReplicaImplementation; |
| 50 | friend class QRemoteObjectNode; |
| 51 | }; |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif // QREMOTEOBJECTS_ABSTRACTITEMMODELREPLICA_H |
| 56 | |