The QItemSelectionRange class manages information about a range of selected items in a model. 更多...
头: | #include <QItemSelectionRange> |
qmake: | QT += core |
QItemSelectionRange () | |
QItemSelectionRange (const QItemSelectionRange & other ) | |
QItemSelectionRange (QItemSelectionRange && other ) | |
QItemSelectionRange (const QModelIndex & topLeft , const QModelIndex & bottomRight ) | |
QItemSelectionRange (const QModelIndex & index ) | |
int | bottom () const |
const QPersistentModelIndex & | bottomRight () const |
bool | contains (const QModelIndex & index ) const |
bool | contains (int row , int column , const QModelIndex & parentIndex ) const |
int | height () const |
QModelIndexList | indexes () const |
QItemSelectionRange | intersected (const QItemSelectionRange & other ) const |
bool | intersects (const QItemSelectionRange & other ) const |
bool | isEmpty () const |
bool | isValid () const |
int | left () const |
const QAbstractItemModel * | model () const |
QModelIndex | parent () const |
int | right () const |
void | swap (QItemSelectionRange & other ) |
int | top () const |
const QPersistentModelIndex & | topLeft () const |
int | width () const |
bool | operator!= (const QItemSelectionRange & other ) const |
bool | operator< (const QItemSelectionRange & other ) const |
QItemSelectionRange & | operator= (QItemSelectionRange && other ) |
QItemSelectionRange & | operator= (const QItemSelectionRange & other ) |
bool | operator== (const QItemSelectionRange & other ) const |
The QItemSelectionRange class manages information about a range of selected items in a model.
A QItemSelectionRange contains information about a range of selected items in a model. A range of items is a contiguous array of model items, extending to cover a number of adjacent rows and columns with a common parent item; this can be visualized as a two-dimensional block of cells in a table. A selection range has a top (), left () bottom (), right () 和 parent ().
The QItemSelectionRange 类是一种 模型/视图类 且属于 Qt 的 模型/视图框架 .
The model items contained in the selection range can be obtained using the indexes () function. Use QItemSelectionModel::selectedIndexes () to get a list of all selected items for a view.
You can determine whether a given model item lies within a particular range by using the contains () function. Ranges can also be compared using the overloaded operators for equality and inequality, and the intersects () function allows you to determine whether two ranges overlap.
另请参阅 模型/视图编程 , QAbstractItemModel , QItemSelection ,和 QItemSelectionModel .
Constructs an empty selection range.
Copy constructor. Constructs a new selection range with the same contents as the other range given.
移动拷贝构造函数。
Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight .
Constructs a new selection range containing only the model item specified by the model index index .
Returns the row index corresponding to the lowermost selected row in the selection range.
Returns the index for the item located at the bottom-right corner of the selection range.
另请参阅 bottom (), right (),和 topLeft ().
返回
true
if the model item specified by the
index
lies within the range of selected items; otherwise returns
false
.
这是重载函数。
返回
true
if the model item specified by (
row
,
column
) and with
parentIndex
as the parent item lies within the range of selected items; otherwise returns
false
.
Returns the number of selected rows in the selection range.
Returns the list of model index items stored in the selection.
Returns a new selection range containing only the items that are found in both the selection range and the other selection range.
该函数在 Qt 4.2 引入。
返回
true
if this selection range intersects (overlaps with) the
other
range given; otherwise returns
false
.
返回
true
if the selection range contains no selectable item
该函数在 Qt 4.7 引入。
返回
true
if the selection range is valid; otherwise returns
false
.
Returns the column index corresponding to the leftmost selected column in the selection range.
Returns the model that the items in the selection range belong to.
Returns the parent model item index of the items in the selection range.
Returns the column index corresponding to the rightmost selected column in the selection range.
Swaps this selection range's contents with other 。此函数非常快且从不失败。
该函数在 Qt 5.6 引入。
Returns the row index corresponding to the uppermost selected row in the selection range.
Returns the index for the item located at the top-left corner of the selection range.
另请参阅 top (), left (),和 bottomRight ().
Returns the number of selected columns in the selection range.
返回
true
if the selection range differs from the
other
range given; otherwise returns
false
.
返回
true
if the selection range is less than the
other
range given; otherwise returns
false
.
The less than calculation is not directly useful to developers - the way that ranges with different parents compare is not defined. This operator only exists so that the class can be used with QMap .
移动赋值运算符。
拷贝赋值运算符。
返回
true
if the selection range is exactly the same as the
other
range given; otherwise returns
false
.