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
11QT_BEGIN_NAMESPACE
12
13class QConcatenateTablesProxyModelPrivate;
14
15class Q_CORE_EXPORT QConcatenateTablesProxyModel : public QAbstractItemModel
16{
17 Q_OBJECT
18
19public:
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 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
66QT_END_NAMESPACE
67
68#endif // QCONCATENATEROWSPROXYMODEL_H
69

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