QTransposeProxyModel Class
The QTransposeProxyModel class provides a proxy that swaps the rows and columns of its source model. More…
| Header | #include <QTransposeProxyModel> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Since | 5.13 |
| Inherits | QAbstractProxyModel |
List of all members, including inherited members
Public Functions
| QTransposeProxyModel(QObject *parent = nullptr) | |
| ~QTransposeProxyModel() |
Reimplemented Public Functions
| void | setSourceModel(QAbstractItemModel *newSourceModel) |
| int | rowCount(const QModelIndex &parent = QModelIndex()) const |
| int | columnCount(const QModelIndex &parent = QModelIndex()) const |
| QVariant | headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const |
| bool | setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) |
| QSize | span(const QModelIndex &index) const |
| QModelIndex | mapFromSource(const QModelIndex &sourceIndex) const |
| QModelIndex | mapToSource(const QModelIndex &proxyIndex) const |
| QModelIndex | parent(const QModelIndex &index) const |
| QModelIndex | index(int row, int column, const QModelIndex &parent = QModelIndex()) const |
| bool | insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) |
| bool | removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) |
| bool | moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) |
| bool | insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) |
| bool | removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) |
| bool | moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) |
| void | sort(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
QTransposeProxyModel::QTransposeProxyModel(QObject *parent = nullptr)
Constructs a transposing proxy with the given parent.
QTransposeProxyModel::~QTransposeProxyModel()
Destroys the proxy.
int QTransposeProxyModel::columnCount(const QModelIndex &parent = QModelIndex()) const
Reimplements QAbstractProxyModel::columnCount().
Returns the number of rows of the source under parent.
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.
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.
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.
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.
QModelIndex QTransposeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
Reimplements QAbstractProxyModel::mapFromSource().
Returns the proxy index of sourceIndex, with its row and column swapped.
QModelIndex QTransposeProxyModel::mapToSource(const QModelIndex &proxyIndex) const
Reimplements QAbstractProxyModel::mapToSource().
Returns the source index of proxyIndex, with its row and column swapped.
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.
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.
QModelIndex QTransposeProxyModel::parent(const QModelIndex &index) const
Reimplements QAbstractProxyModel::parent().
Returns the parent of index.
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.
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.
int QTransposeProxyModel::rowCount(const QModelIndex &parent = QModelIndex()) const
Reimplements QAbstractProxyModel::rowCount().
Returns the number of columns of the source under parent.
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.
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.
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.
QSize QTransposeProxyModel::span(const QModelIndex &index) const
Reimplements QAbstractProxyModel::span().
Returns the span of the source item of index, transposed.