1 | // Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | |
5 | #ifndef QIDENTITYPROXYMODEL_H |
6 | #define QIDENTITYPROXYMODEL_H |
7 | |
8 | #include <QtCore/qabstractproxymodel.h> |
9 | |
10 | QT_REQUIRE_CONFIG(identityproxymodel); |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | |
15 | class QIdentityProxyModelPrivate; |
16 | |
17 | class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel |
18 | { |
19 | Q_OBJECT |
20 | public: |
21 | explicit QIdentityProxyModel(QObject* parent = nullptr); |
22 | ~QIdentityProxyModel(); |
23 | |
24 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; |
25 | QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; |
26 | QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; |
27 | QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; |
28 | QModelIndex parent(const QModelIndex& child) const override; |
29 | using QObject::parent; |
30 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
31 | QVariant (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |
32 | bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; |
33 | QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; |
34 | |
35 | QItemSelection mapSelectionFromSource(const QItemSelection& selection) const override; |
36 | QItemSelection mapSelectionToSource(const QItemSelection& selection) const override; |
37 | QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; |
38 | void setSourceModel(QAbstractItemModel* sourceModel) override; |
39 | |
40 | bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; |
41 | bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; |
42 | bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; |
43 | bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; |
44 | bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; |
45 | bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override; |
46 | |
47 | bool handleSourceLayoutChanges() const; |
48 | bool handleSourceDataChanges() const; |
49 | |
50 | protected: |
51 | QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent); |
52 | void setHandleSourceLayoutChanges(bool); |
53 | void setHandleSourceDataChanges(bool); |
54 | |
55 | private: |
56 | Q_DECLARE_PRIVATE(QIdentityProxyModel) |
57 | Q_DISABLE_COPY(QIdentityProxyModel) |
58 | }; |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QIDENTITYPROXYMODEL_H |
63 | |
64 | |