| 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 | // Qt-Security score:significant reason:default |
| 4 | |
| 5 | #ifndef QCONCATENATEROWSPROXYMODEL_H |
| 6 | #define QCONCATENATEROWSPROXYMODEL_H |
| 7 | |
| 8 | #include <QtCore/qabstractitemmodel.h> |
| 9 | |
| 10 | QT_REQUIRE_CONFIG(concatenatetablesproxymodel); |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QConcatenateTablesProxyModelPrivate; |
| 15 | |
| 16 | class Q_CORE_EXPORT QConcatenateTablesProxyModel : public QAbstractItemModel |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | |
| 20 | public: |
| 21 | explicit QConcatenateTablesProxyModel(QObject *parent = nullptr); |
| 22 | ~QConcatenateTablesProxyModel(); |
| 23 | |
| 24 | QList<QAbstractItemModel *> sourceModels() const; |
| 25 | Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel); |
| 26 | Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel); |
| 27 | |
| 28 | QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; |
| 29 | QModelIndex mapToSource(const QModelIndex &proxyIndex) const; |
| 30 | |
| 31 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
| 32 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; |
| 33 | QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const override; |
| 34 | bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override; |
| 35 | Qt::ItemFlags flags(const QModelIndex &index) const override; |
| 36 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; |
| 37 | QModelIndex parent(const QModelIndex &index) const override; |
| 38 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 39 | QVariant (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |
| 40 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; |
| 41 | QStringList mimeTypes() const override; |
| 42 | QMimeData *mimeData(const QModelIndexList &indexes) const override; |
| 43 | bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override; |
| 44 | bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; |
| 45 | QSize span(const QModelIndex &index) const override; |
| 46 | QHash<int, QByteArray> roleNames() const override; |
| 47 | |
| 48 | private: |
| 49 | Q_DECLARE_PRIVATE(QConcatenateTablesProxyModel) |
| 50 | Q_DISABLE_COPY(QConcatenateTablesProxyModel) |
| 51 | }; |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif // QCONCATENATEROWSPROXYMODEL_H |
| 56 | |