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 | |
9 | QT_REQUIRE_CONFIG(concatenatetablesproxymodel); |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QConcatenateTablesProxyModelPrivate; |
14 | |
15 | class Q_CORE_EXPORT QConcatenateTablesProxyModel : public QAbstractItemModel |
16 | { |
17 | Q_OBJECT |
18 | |
19 | public: |
20 | explicit QConcatenateTablesProxyModel(QObject *parent = nullptr); |
21 | ~QConcatenateTablesProxyModel(); |
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 (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 | |
46 | private: |
47 | Q_DECLARE_PRIVATE(QConcatenateTablesProxyModel) |
48 | Q_DISABLE_COPY(QConcatenateTablesProxyModel) |
49 | }; |
50 | |
51 | QT_END_NAMESPACE |
52 | |
53 | #endif // QCONCATENATEROWSPROXYMODEL_H |
54 | |