1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtCore module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | |
41 | #ifndef QIDENTITYPROXYMODEL_H |
42 | #define QIDENTITYPROXYMODEL_H |
43 | |
44 | #include <QtCore/qabstractproxymodel.h> |
45 | |
46 | QT_REQUIRE_CONFIG(identityproxymodel); |
47 | |
48 | QT_BEGIN_NAMESPACE |
49 | |
50 | |
51 | class QIdentityProxyModelPrivate; |
52 | |
53 | class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel |
54 | { |
55 | Q_OBJECT |
56 | public: |
57 | explicit QIdentityProxyModel(QObject* parent = nullptr); |
58 | ~QIdentityProxyModel(); |
59 | |
60 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; |
61 | QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; |
62 | QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; |
63 | QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; |
64 | QModelIndex parent(const QModelIndex& child) const override; |
65 | using QObject::parent; |
66 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
67 | QVariant (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |
68 | bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; |
69 | QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; |
70 | |
71 | QItemSelection mapSelectionFromSource(const QItemSelection& selection) const override; |
72 | QItemSelection mapSelectionToSource(const QItemSelection& selection) const override; |
73 | QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; |
74 | void setSourceModel(QAbstractItemModel* sourceModel) override; |
75 | |
76 | bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; |
77 | bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; |
78 | bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; |
79 | bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; |
80 | bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; |
81 | bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override; |
82 | |
83 | protected: |
84 | QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent); |
85 | |
86 | private: |
87 | Q_DECLARE_PRIVATE(QIdentityProxyModel) |
88 | Q_DISABLE_COPY(QIdentityProxyModel) |
89 | |
90 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(QModelIndex,int,int)) |
91 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(QModelIndex,int,int)) |
92 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)) |
93 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsRemoved(QModelIndex,int,int)) |
94 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)) |
95 | Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)) |
96 | |
97 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)) |
98 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsInserted(QModelIndex,int,int)) |
99 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)) |
100 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsRemoved(QModelIndex,int,int)) |
101 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)) |
102 | Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)) |
103 | |
104 | Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)) |
105 | Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)) |
106 | |
107 | Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)) |
108 | Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)) |
109 | Q_PRIVATE_SLOT(d_func(), void _q_sourceModelAboutToBeReset()) |
110 | Q_PRIVATE_SLOT(d_func(), void _q_sourceModelReset()) |
111 | }; |
112 | |
113 | QT_END_NAMESPACE |
114 | |
115 | #endif // QIDENTITYPROXYMODEL_H |
116 | |
117 | |