Qt 6.x
The Qt SDK
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qidentityproxymodel.h
Go to the documentation of this file.
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
13
14
16
17class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel
18{
20public:
21 explicit QIdentityProxyModel(QObject* parent = nullptr);
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
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
47protected:
49
50private:
51 Q_DECLARE_PRIVATE(QIdentityProxyModel)
52 Q_DISABLE_COPY(QIdentityProxyModel)
53
54 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(QModelIndex,int,int))
55 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(QModelIndex,int,int))
56 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(QModelIndex,int,int))
57 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsRemoved(QModelIndex,int,int))
58 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))
59 Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int))
60
61 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeInserted(QModelIndex,int,int))
62 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsInserted(QModelIndex,int,int))
63 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int))
64 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsRemoved(QModelIndex,int,int))
65 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))
66 Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))
67
68 Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex, QModelIndex, QList<int>))
69 Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last))
70
71 Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
72 Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
73 Q_PRIVATE_SLOT(d_func(), void _q_sourceModelAboutToBeReset())
74 Q_PRIVATE_SLOT(d_func(), void _q_sourceModelReset())
75};
76
78
79#endif // QIDENTITYPROXYMODEL_H
80
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
virtual Q_INVOKABLE QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
Returns a list of indexes for the items in the column of the start index where data stored under the ...
LayoutChangeHint
This enum describes the way the model changes layout.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
QModelIndex sibling(int row, int column, const QModelIndex &idx) const override
\reimp
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
\reimp
virtual Q_INVOKABLE QItemSelection mapSelectionFromSource(const QItemSelection &selection) const
Returns a proxy selection mapped from the specified sourceSelection.
virtual Q_INVOKABLE QModelIndex mapToSource(const QModelIndex &proxyIndex) const =0
Reimplement this function to return the model index in the source model that corresponds to the proxy...
virtual Q_INVOKABLE QModelIndex mapFromSource(const QModelIndex &sourceIndex) const =0
Reimplement this function to return the model index in the proxy model that corresponds to the source...
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
\reimp
virtual Q_INVOKABLE QItemSelection mapSelectionToSource(const QItemSelection &selection) const
Returns a source selection mapped from the specified proxySelection.
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
The QIdentityProxyModel class proxies its source model unmodified.
\inmodule QtCore
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
Orientation
Definition qnamespace.h:97
@ DisplayRole
DropAction
@ MatchWrap
@ MatchStartsWith
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLenum GLenum GLsizei count
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint start
GLint first
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
QItemSelection * selection
[0]
QLayoutItem * child
[0]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent