QTransposeProxyModel Class

This proxy transposes the source model. More...

Header: #include <QTransposeProxyModel>
CMake: find_package(Qt6 COMPONENTS Core REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 5.13
Inherits: QAbstractProxyModel

Public Functions

QTransposeProxyModel(QObject *parent = nullptr)
virtual ~QTransposeProxyModel()

Reimplemented Public Functions

virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override
virtual QMap<int, QVariant> itemData(const QModelIndex &index) const override
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
virtual bool moveColumns(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
virtual QModelIndex parent(const QModelIndex &index) const override
virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override
virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override
virtual void setSourceModel(QAbstractItemModel *newSourceModel) override
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override
virtual QSize span(const QModelIndex &index) const override

Detailed Description

This model will make the rows of the source model become columns of the proxy model and vice-versa.

If the model is a tree, the parents will be transposed as well. For example, if an index in the source model had parent `index(2,0)`, it will have parent `index(0,2)` in the proxy.

Member Function Documentation

QTransposeProxyModel::QTransposeProxyModel(QObject *parent = nullptr)

Constructs a new proxy model with the given parent.

[virtual] QTransposeProxyModel::~QTransposeProxyModel()

Destructs the proxy model.

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

Reimplements: QAbstractItemModel::columnCount(const QModelIndex &parent) const.

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

Reimplements: QAbstractProxyModel::headerData(int section, Qt::Orientation orientation, int role) const.

See also setHeaderData().

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

Reimplements: QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const.

[override virtual] bool QTransposeProxyModel::insertColumns(int column, int count, const QModelIndex &parent = QModelIndex())

Reimplements: QAbstractItemModel::insertColumns(int column, int count, const QModelIndex &parent).

[override virtual] bool QTransposeProxyModel::insertRows(int row, int count, const QModelIndex &parent = QModelIndex())

Reimplements: QAbstractItemModel::insertRows(int row, int count, const QModelIndex &parent).

[override virtual] QMap<int, QVariant> QTransposeProxyModel::itemData(const QModelIndex &index) const

Reimplements: QAbstractProxyModel::itemData(const QModelIndex &proxyIndex) const.

See also setItemData().

[override virtual] QModelIndex QTransposeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const

Reimplements: QAbstractProxyModel::mapFromSource(const QModelIndex &sourceIndex) const.

[override virtual] QModelIndex QTransposeProxyModel::mapToSource(const QModelIndex &proxyIndex) const

Reimplements: QAbstractProxyModel::mapToSource(const QModelIndex &proxyIndex) const.

[override virtual] bool QTransposeProxyModel::moveColumns(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)

Reimplements: QAbstractItemModel::moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild).

[override virtual] bool QTransposeProxyModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)

Reimplements: QAbstractItemModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild).

[override virtual] QModelIndex QTransposeProxyModel::parent(const QModelIndex &index) const

Reimplements: QAbstractItemModel::parent(const QModelIndex &index) const.

[override virtual] bool QTransposeProxyModel::removeColumns(int column, int count, const QModelIndex &parent = QModelIndex())

Reimplements: QAbstractItemModel::removeColumns(int column, int count, const QModelIndex &parent).

[override virtual] bool QTransposeProxyModel::removeRows(int row, int count, const QModelIndex &parent = QModelIndex())

Reimplements: QAbstractItemModel::removeRows(int row, int count, const QModelIndex &parent).

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

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

[override virtual] bool QTransposeProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole)

Reimplements: QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role).

See also headerData().

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

Reimplements: QAbstractProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles).

See also itemData().

[override virtual] void QTransposeProxyModel::setSourceModel(QAbstractItemModel *newSourceModel)

Reimplements: QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel).

[override virtual] void QTransposeProxyModel::sort(int column, Qt::SortOrder order = Qt::AscendingOrder)

Reimplements: QAbstractProxyModel::sort(int column, Qt::SortOrder order).

This method will perform no action. Use a QSortFilterProxyModel on top of this one if you require sorting.

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

Reimplements: QAbstractProxyModel::span(const QModelIndex &index) const.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.0/qtransposeproxymodel.html