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