6.0.0-rc4Source

QTransposeProxyModel Class

The QTransposeProxyModel class provides a proxy that swaps the rows and columns of its source model. More…

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

List of all members, including inherited members

Public Functions

Reimplemented Public Functions

voidsetSourceModel(QAbstractItemModel *newSourceModel)
introwCount(const QModelIndex &parent = QModelIndex()) const
intcolumnCount(const QModelIndex &parent = QModelIndex()) const
QVariantheaderData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
boolsetHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole)
QSizespan(const QModelIndex &index) const
QModelIndexmapFromSource(const QModelIndex &sourceIndex) const
QModelIndexmapToSource(const QModelIndex &proxyIndex) const
QModelIndexparent(const QModelIndex &index) const
QModelIndexindex(int row, int column, const QModelIndex &parent = QModelIndex()) const
boolinsertRows(int row, int count, const QModelIndex &parent = QModelIndex())
boolremoveRows(int row, int count, const QModelIndex &parent = QModelIndex())
boolmoveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
boolinsertColumns(int column, int count, const QModelIndex &parent = QModelIndex())
boolremoveColumns(int column, int count, const QModelIndex &parent = QModelIndex())
boolmoveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)
voidsort(int column, Qt::SortOrder order = Qt::AscendingOrder)

Detailed Description

The item at row r and column c of the proxy is the item at row c and column r of the source, at every level of a tree, and the horizontal and vertical headers are swapped too.

See also QAbstractProxyModel.

Differences from Qt

None.

Member Function Documentation

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

Constructs a transposing proxy with the given parent.

[override] QTransposeProxyModel::~QTransposeProxyModel()

Destroys the proxy.

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

Reimplements QAbstractProxyModel::columnCount().

Returns the number of rows of the source under parent.

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

Reimplements QAbstractProxyModel::headerData().

Returns the source header data of section in the other orientation than orientation, for role.

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

Reimplements QAbstractProxyModel::index().

Returns the proxy index for row and column under parent.

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

Reimplements QAbstractProxyModel::insertColumns().

Inserts count rows before row column under parent in the source.

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

Reimplements QAbstractProxyModel::insertRows().

Inserts count columns before column row under parent in the source.

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

Reimplements QAbstractProxyModel::mapFromSource().

Returns the proxy index of sourceIndex, with its row and column swapped.

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

Reimplements QAbstractProxyModel::mapToSource().

Returns the source index of proxyIndex, with its row and column swapped.

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

Reimplements QAbstractProxyModel::moveColumns().

Moves count source rows from sourceColumn under sourceParent to before destinationChild under destinationParent.

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

Reimplements QAbstractProxyModel::moveRows().

Moves count source columns from sourceRow under sourceParent to before destinationChild under destinationParent.

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

Reimplements QAbstractProxyModel::parent().

Returns the parent of index.

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

Reimplements QAbstractProxyModel::removeColumns().

Removes count rows from row column under parent in the source.

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

Reimplements QAbstractProxyModel::removeRows().

Removes count columns from column row under parent in the source.

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

Reimplements QAbstractProxyModel::rowCount().

Returns the number of columns of the source under parent.

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

Reimplements QAbstractProxyModel::setHeaderData().

Sets the source header data of section in the other orientation than orientation, for role, to value.

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

Reimplements QAbstractProxyModel::setSourceModel().

Sets the source model to newSourceModel, resetting the proxy. Row changes of the source become column changes of the proxy and the other way round.

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

Reimplements QAbstractProxyModel::sort().

Sorts the source by column in order. Since rows and columns are swapped, sorting a transposed table sorts the source's rows by the source column column.

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

Reimplements QAbstractProxyModel::span().

Returns the span of the source item of index, transposed.