Qt 6.x
The Qt SDK
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qconcatenatetablesproxymodel.h
Go to the documentation of this file.
1// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@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#ifndef QCONCATENATEROWSPROXYMODEL_H
5#define QCONCATENATEROWSPROXYMODEL_H
6
7#include <QtCore/qabstractitemmodel.h>
8
9QT_REQUIRE_CONFIG(concatenatetablesproxymodel);
10
12
14
16{
18
19public:
20 explicit QConcatenateTablesProxyModel(QObject *parent = nullptr);
22
23 QList<QAbstractItemModel *> sourceModels() const;
24 Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel);
25 Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel);
26
27 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
28 QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
29
30 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
31 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
32 QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const override;
33 bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
34 Qt::ItemFlags flags(const QModelIndex &index) const override;
35 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
36 QModelIndex parent(const QModelIndex &index) const override;
37 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
38 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
39 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
40 QStringList mimeTypes() const override;
41 QMimeData *mimeData(const QModelIndexList &indexes) const override;
42 bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
43 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
44 QSize span(const QModelIndex &index) const override;
45
46private:
47 Q_DECLARE_PRIVATE(QConcatenateTablesProxyModel)
48 Q_DISABLE_COPY(QConcatenateTablesProxyModel)
49
50 Q_PRIVATE_SLOT(d_func(), void _q_slotRowsAboutToBeInserted(const QModelIndex &, int start, int end))
51 Q_PRIVATE_SLOT(d_func(), void _q_slotRowsInserted(const QModelIndex &, int start, int end))
52 Q_PRIVATE_SLOT(d_func(), void _q_slotRowsAboutToBeRemoved(const QModelIndex &, int start, int end))
53 Q_PRIVATE_SLOT(d_func(), void _q_slotRowsRemoved(const QModelIndex &, int start, int end))
54 Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end))
55 Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsInserted(const QModelIndex &parent, int, int))
56 Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end))
57 Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsRemoved(const QModelIndex &parent, int, int))
58 Q_PRIVATE_SLOT(d_func(),
59 void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QList<int> &roles))
60 Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint))
61 Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint))
62 Q_PRIVATE_SLOT(d_func(), void _q_slotModelAboutToBeReset())
63 Q_PRIVATE_SLOT(d_func(), void _q_slotModelReset())
64};
65
67
68#endif // QCONCATENATEROWSPROXYMODEL_H
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
Returns {true} if a model can accept a drop of the data.
LayoutChangeHint
This enum describes the way the model changes layout.
virtual Q_INVOKABLE QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles the data supplied by a drag and drop operation that ended with the given action.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
virtual QMap< int, QVariant > itemData(const QModelIndex &index) const
Returns a map with values for all predefined roles in the model for the item at the given index.
virtual bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles)
Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole...
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
virtual QStringList mimeTypes() const
Returns the list of allowed MIME types.
The QConcatenateTablesProxyModel class proxies multiple source models, concatenating their rows.
Definition qlist.h:74
Definition qmap.h:186
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
Definition qsize.h:25
\inmodule QtCore
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
Orientation
Definition qnamespace.h:97
@ EditRole
@ DisplayRole
DropAction
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLuint GLuint end
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint start
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SCRIPTABLE
#define Q_PRIVATE_SLOT(d, signature)
QMimeData * mimeData
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent