QItemSelectionRange¶
The QItemSelectionRange
class manages information about a range of selected items in a model. More…
Synopsis¶
Functions¶
def
__eq__
(other)def
__ne__
(other)def
bottom
()def
bottomRight
()def
contains
(index)def
contains
(row, column, parentIndex)def
height
()def
indexes
()def
intersected
(other)def
intersects
(other)def
isEmpty
()def
isValid
()def
left
()def
model
()def
parent
()def
right
()def
swap
(other)def
top
()def
topLeft
()def
width
()
Detailed Description¶
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()
a bottom()
, right()
and a parent()
.
The QItemSelectionRange
class is one of the Model/View Classes and is part of Qt’s model/view framework .
The model items contained in the selection range can be obtained using the indexes()
function. Use 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.
- class PySide6.QtCore.QItemSelectionRange¶
PySide6.QtCore.QItemSelectionRange(QItemSelectionRange)
PySide6.QtCore.QItemSelectionRange(index)
PySide6.QtCore.QItemSelectionRange(topL, bottomR)
- Parameters
topL –
PySide6.QtCore.QModelIndex
QItemSelectionRange –
PySide6.QtCore.QItemSelectionRange
index –
PySide6.QtCore.QModelIndex
bottomR –
PySide6.QtCore.QModelIndex
Constructs an empty selection range.
Constructs a new selection range containing only the model item specified by the model index index
.
Constructs a new selection range containing only the index specified by the topLeft
and the index bottomRight
.
- PySide6.QtCore.QItemSelectionRange.bottom()¶
- Return type
int
Returns the row index corresponding to the lowermost selected row in the selection range.
- PySide6.QtCore.QItemSelectionRange.bottomRight()¶
- Return type
Returns the index for the item located at the bottom-right corner of the selection range.
- PySide6.QtCore.QItemSelectionRange.contains(index)¶
- Parameters
index –
PySide6.QtCore.QModelIndex
- Return type
bool
Returns true
if the model item specified by the index
lies within the range of selected items; otherwise returns false
.
- PySide6.QtCore.QItemSelectionRange.contains(row, column, parentIndex)
- Parameters
row – int
column – int
parentIndex –
PySide6.QtCore.QModelIndex
- Return type
bool
This is an overloaded function.
Returns 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
.
- PySide6.QtCore.QItemSelectionRange.height()¶
- Return type
int
Returns the number of selected rows in the selection range.
- PySide6.QtCore.QItemSelectionRange.indexes()¶
- Return type
QModelIndexList
Returns the list of model index items stored in the selection.
- PySide6.QtCore.QItemSelectionRange.intersected(other)¶
- Parameters
- Return type
Returns a new selection range containing only the items that are found in both the selection range and the other
selection range.
- PySide6.QtCore.QItemSelectionRange.intersects(other)¶
- Parameters
- Return type
bool
Returns true
if this selection range intersects (overlaps with) the other
range given; otherwise returns false
.
- PySide6.QtCore.QItemSelectionRange.isEmpty()¶
- Return type
bool
Returns true
if the selection range contains either no items or only items which are either disabled or marked as not selectable.
- PySide6.QtCore.QItemSelectionRange.isValid()¶
- Return type
bool
Returns true
if the selection range is valid; otherwise returns false
.
- PySide6.QtCore.QItemSelectionRange.left()¶
- Return type
int
Returns the column index corresponding to the leftmost selected column in the selection range.
- PySide6.QtCore.QItemSelectionRange.model()¶
- Return type
Returns the model that the items in the selection range belong to.
- PySide6.QtCore.QItemSelectionRange.__ne__(other)¶
- Parameters
- Return type
bool
Returns true
if the selection range differs from the other
range given; otherwise returns false
.
- PySide6.QtCore.QItemSelectionRange.__eq__(other)¶
- Parameters
- Return type
bool
Returns true
if the selection range is exactly the same as the other
range given; otherwise returns false
.
- PySide6.QtCore.QItemSelectionRange.parent()¶
- Return type
Returns the parent model item index of the items in the selection range.
- PySide6.QtCore.QItemSelectionRange.right()¶
- Return type
int
Returns the column index corresponding to the rightmost selected column in the selection range.
- PySide6.QtCore.QItemSelectionRange.swap(other)¶
- Parameters
Swaps this selection range’s contents with other
. This function is very fast and never fails.
- PySide6.QtCore.QItemSelectionRange.top()¶
- Return type
int
Returns the row index corresponding to the uppermost selected row in the selection range.
- PySide6.QtCore.QItemSelectionRange.topLeft()¶
- Return type
Returns the index for the item located at the top-left corner of the selection range.
See also
- PySide6.QtCore.QItemSelectionRange.width()¶
- Return type
int
Returns the number of selected columns in the selection range.
© 2022 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.