6.0.0-rc4Source

QConcatenateTablesProxyModel Class

The QConcatenateTablesProxyModel class proxies multiple source models, concatenating their rows. More…

Header#include <QConcatenateTablesProxyModel>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
Since5.13
InheritsQAbstractItemModel

List of all members, including inherited members

Public Functions

Reimplemented Public Functions

QVariantdata(const QModelIndex &index, int role = Qt::DisplayRole) const
boolsetData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole)
QMap<int, QVariant>itemData(const QModelIndex &proxyIndex) const
boolsetItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
Qt::ItemFlagsflags(const QModelIndex &index) const
QModelIndexindex(int row, int column, const QModelIndex &parent = QModelIndex()) const
QModelIndexparent(const QModelIndex &index) const
introwCount(const QModelIndex &parent = QModelIndex()) const
QVariantheaderData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
intcolumnCount(const QModelIndex &parent = QModelIndex()) const
QStringListmimeTypes() const
QMimeData *mimeData(const QModelIndexList &indexes) const
boolcanDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
booldropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
QSizespan(const QModelIndex &index) const

Detailed Description

The rows of the first source model come first, followed by those of the second, and so on. The proxy has as many columns as the source with the fewest. The source models must be flat: their items have no children.

QConcatenateTablesProxyModel all;
all.addSourceModel(&inbox);
all.addSourceModel(&archive);

See also QAbstractItemModel.

Differences from Qt

A change of the column count of a source resets the proxy.

Member Function Documentation

[explicit] QConcatenateTablesProxyModel::QConcatenateTablesProxyModel(QObject *parent = nullptr)

Constructs a proxy with the given parent and no source models.

[override] QConcatenateTablesProxyModel::~QConcatenateTablesProxyModel()

Destroys the proxy.

void QConcatenateTablesProxyModel::addSourceModel(QAbstractItemModel *sourceModel)

Appends the rows of sourceModel, which must be a flat model. The proxy follows the changes of the source from then on.

See also removeSourceModel().

[override] bool QConcatenateTablesProxyModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const

Reimplements QAbstractItemModel::canDropMimeData().

Returns whether the source model at row accepts data dropped with action at column under parent.

[override] int QConcatenateTablesProxyModel::columnCount(const QModelIndex &parent = QModelIndex()) const

Reimplements QAbstractItemModel::columnCount().

Returns the smallest column count of the source models, or 0 for a valid parent.

[override] QVariant QConcatenateTablesProxyModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplements QAbstractItemModel::data().

Returns the data of the source item of index for role.

[override] bool QConcatenateTablesProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)

Reimplements QAbstractItemModel::dropMimeData().

Drops data with action into the source model at row and column under parent.

[override] Qt::ItemFlags QConcatenateTablesProxyModel::flags(const QModelIndex &index) const

Reimplements QAbstractItemModel::flags().

Returns the flags of the source item of index, or none for an invalid index.

[override] QVariant QConcatenateTablesProxyModel::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const

Reimplements QAbstractItemModel::headerData().

Returns the header data of section in orientation for role: the horizontal headers come from the first source model, and the vertical headers from the source of each row.

[override] QModelIndex QConcatenateTablesProxyModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const

Reimplements QAbstractItemModel::index().

Returns the index at row and column; parent must be invalid.

[override] QMap<int, QVariant> QConcatenateTablesProxyModel::itemData(const QModelIndex &proxyIndex) const

Reimplements QAbstractItemModel::itemData().

Returns the item data of the source item of proxyIndex.

QModelIndex QConcatenateTablesProxyModel::mapFromSource(const QModelIndex &sourceIndex) const

Returns the proxy index of sourceIndex, an index of one of the source models, or an invalid index.

QModelIndex QConcatenateTablesProxyModel::mapToSource(const QModelIndex &proxyIndex) const

Returns the source index of proxyIndex, or an invalid index.

[override] QMimeData * QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes) const

Reimplements QAbstractItemModel::mimeData().

Returns the MIME data of the source items of indexes, which must all belong to the same source model; otherwise returns nullptr.

[override] QStringList QConcatenateTablesProxyModel::mimeTypes() const

Reimplements QAbstractItemModel::mimeTypes().

Returns the MIME types that all source models support.

[override] QModelIndex QConcatenateTablesProxyModel::parent(const QModelIndex &index) const

Reimplements QAbstractItemModel::parent().

Returns an invalid index: the proxy is flat. index is not used.

void QConcatenateTablesProxyModel::removeSourceModel(QAbstractItemModel *sourceModel)

Removes the rows of sourceModel from the proxy.

See also addSourceModel().

[override] int QConcatenateTablesProxyModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplements QAbstractItemModel::rowCount().

Returns the total number of rows of the source models, or 0 for a valid parent.

[override] bool QConcatenateTablesProxyModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole)

Reimplements QAbstractItemModel::setData().

Sets the data of the source item of index for role to value.

[override] bool QConcatenateTablesProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)

Reimplements QAbstractItemModel::setItemData().

Sets the item data of the source item of index to roles.

QList<QAbstractItemModel *> QConcatenateTablesProxyModel::sourceModels() const

Returns the source models, in the order their rows appear.

[override] QSize QConcatenateTablesProxyModel::span(const QModelIndex &index) const

Reimplements QAbstractItemModel::span().

Returns the span of the source item of index.