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
10QT_REQUIRE_CONFIG(identityproxymodel);
11
12QT_BEGIN_NAMESPACE
13
14
15class QIdentityProxyModelPrivate;
16
17class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel
18{
19 Q_OBJECT
20public:
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 headerData(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
50protected:
51 QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent);
52 void setHandleSourceLayoutChanges(bool);
53 void setHandleSourceDataChanges(bool);
54
55private:
56 Q_DECLARE_PRIVATE(QIdentityProxyModel)
57 Q_DISABLE_COPY(QIdentityProxyModel)
58};
59
60QT_END_NAMESPACE
61
62#endif // QIDENTITYPROXYMODEL_H
63
64

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtbase/src/corelib/itemmodels/qidentityproxymodel.h