QTableWidgetSelectionRange Class

QTableWidgetSelectionRange 类提供了一种无需使用模型索引和选择模型即可与模型中的选择进行交互的方法。更多

Header: #include <QTableWidgetSelectionRange>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets

公共函数

QTableWidgetSelectionRange()
QTableWidgetSelectionRange(int top, int left, int bottom, int right)
int bottomRow() const
int columnCount() const
int leftColumn() const
int rightColumn() const
int rowCount() const
int topRow() const
(since 6.3) bool operator!=(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs)
(since 6.3) bool operator==(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs)

详细描述

QTableWidgetSelectionRange 类存储表格中选择范围的左上角和右下角行和列。表格中的选择可能由多个选择范围组成。

注意: 如果选择范围内的项目被标记为不可选,如itemFlags() & Qt::ItemIsSelectable == 0 ,那么它将不会出现在选择范围内。

另请参阅 QTableWidget

成员函数文档

[constexpr noexcept] QTableWidgetSelectionRange::QTableWidgetSelectionRange()

构造一个空的表格选择范围,即rowCount() 和columnCount() 为 0 的范围。

另请参阅 topRow()、leftColumn()、bottomRow() 和rightColumn()。

QTableWidgetSelectionRange::QTableWidgetSelectionRange(int top, int left, int bottom, int right)

根据给定的top,left,bottomright 表格行和列构建表格选择范围。

另请参阅 topRow()、leftColumn()、bottomRow() 和rightColumn()。

int QTableWidgetSelectionRange::bottomRow() const

返回范围的最下面一行。

另请参阅 topRow()、rightColumn() 和rowCount()。

int QTableWidgetSelectionRange::columnCount() const

返回范围内的列数。

相当于rightColumn() -leftColumn() + 1。

另请参阅 rowCount()、leftColumn() 和rightColumn()。

int QTableWidgetSelectionRange::leftColumn() const

返回范围的左列。

另请参阅 rightColumn()、topRow() 和columnCount()。

int QTableWidgetSelectionRange::rightColumn() const

返回范围的右列。

另请参阅 leftColumn()、bottomRow() 和columnCount()。

int QTableWidgetSelectionRange::rowCount() const

返回范围内的行数。

这相当于bottomRow() -topRow() + 1。

另请参阅 columnCount()、topRow() 和bottomRow()。

int QTableWidgetSelectionRange::topRow() const

返回范围的顶行。

另请参阅 bottomRow()、leftColumn() 和rowCount()。

相关非会员

[noexcept, since 6.3] bool operator!=(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs)

如果lhsrhs 不相等,则返回 true,否则返回 false。

此函数在 Qt 6.3 中引入。

[noexcept, since 6.3] bool operator==(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs)

如果lhsrhs 相等,则返回 true,否则返回 false。

此函数在 Qt 6.3 中引入。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.