QTransposeProxyModel 类

此代理转换源模型。 更多...

头文件 #include <QTransposeProxyModel>
CMakefind_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmakeQT += core
继承 QAbstractProxyModel

公共函数

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

重写公共函数

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

详细说明

此模型将源模型的行变成代理模型的列,反之亦然。

如果模型是一个树,父项也将被转置。例如,如果源模型中的索引有父 `index(2,0)`,则它在代理中将有父 `index(0,2)`。

成员函数文档

[显式构造函数] QTransposeProxyModel::QTransposeProxyModel(QObject *parent = nullptr)

使用给定的 父对象 构造一个新的代理模型。

[虚拟非抛出] QTransposeProxyModel::~QTransposeProxyModel()

销毁代理模型。

[覆盖虚函数] int QTransposeProxyModel::columnCount(const QModelIndex &parent = QModelIndex()) const

重写:QAbstractItemModel::columnCount(const QModelIndex &parent) const.

[覆盖虚函数] QVariant QTransposeProxyModel::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const

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

另请参见setHeaderData().

[覆盖虚函数] QModelIndex QTransposeProxyModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const

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

[覆盖虚函数] bool QTransposeProxyModel::insertColumns(int column, int count, const QModelIndex &parent = QModelIndex())

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

[覆盖虚函数] bool QTransposeProxyModel::insertRows(int row, int count, const QModelIndex &parent = QModelIndex())

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

[覆盖虚函数] QMap<int, QVariant> QTransposeProxyModel::itemData(const QModelIndex &index) const

重写:QAbstractProxyModel::itemData(const QModelIndex &proxyIndex) const.

另请参见setItemData().

[重写虚拟] QModelIndex QTransposeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const

重写: QAbstractProxyModel::mapFromSource(const QModelIndex &sourceIndex) const

[重写虚拟] QModelIndex QTransposeProxyModel::mapToSource(const QModelIndex &proxyIndex) const

重写: QAbstractProxyModel::mapToSource(const QModelIndex &proxyIndex) const

[重写虚拟] bool QTransposeProxyModel::moveColumns(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)

重写: QAbstractItemModel::moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)。

[重写虚拟] bool QTransposeProxyModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)

重写: QAbstractItemModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)。

[重写虚拟] QModelIndex QTransposeProxyModel::parent(const QModelIndex &index) const

重写: QAbstractItemModel::parent(const QModelIndex &index) const

[重写虚拟] bool QTransposeProxyModel::removeColumns(int column, int count, const QModelIndex &parent = QModelIndex())

重写: QAbstractItemModel::removeColumns(int column, int count, const QModelIndex &parent)。

[重写虚拟] bool QTransposeProxyModel::removeRows(int row, int count, const QModelIndex &parent = QModelIndex())

重写: QAbstractItemModel::removeRows(int row, int count, const QModelIndex &parent)。

[重写虚拟] int QTransposeProxyModel::rowCount(const QModelIndex &parent = QModelIndex()) const

重写: QAbstractItemModel::rowCount(const QModelIndex &parent) const

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

重新实现: QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role).

另请参阅 headerData().

[重写虚函数] bool QTransposeProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)

重新实现: QAbstractProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles).

另请参阅 itemData().

[重写虚函数] void QTransposeProxyModel::setSourceModel(QAbstractItemModel *newSourceModel)

重新实现: QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel).

[重写虚函数] void QTransposeProxyModel::sort(int column, Qt::SortOrder order = Qt::AscendingOrder)

重新实现: QAbstractProxyModel::sort(int column, Qt::SortOrder order).

此方法不执行任何操作。如果您需要排序,请在之上使用QSortFilterProxyModel

[重写虚函数] QSize QTransposeProxyModel::span(const QModelIndex &index) const

重新实现: QAbstractProxyModel::span(const QModelIndex &index) const.

© 2024 Qt 公司有限公司。此处包含的文档贡献是各自所有者的版权。此处提供的文档是根据自由软件基金会发布的GNU 自由文档许可证版本 1.3许可的。Qt 及其相应的标志是芬兰和/或全世界其他国家的 Qt 公司有限公司的商标。所有其他商标均为其各自所有者的财产。