QItemSelectionRangeclass manages information about a range of selected items in a model. 更多 …
def
__eq__
(other)
def
__lt__
(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
()
A
QItemSelectionRangecontains 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 atop(),left()abottom(),right()和parent().
QItemSelectionRangeclass is one of the 模型/视图类 and is part of Qt’s 模型/视图框架 .The model items contained in the selection range can be obtained using the
indexes()function. UseselectedIndexes()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 theintersects()function allows you to determine whether two ranges overlap.
QItemSelectionRange
¶
QItemSelectionRange(other)
QItemSelectionRange(index)
QItemSelectionRange(topL, bottomR)
- param topL
- param bottomR
- param other
- param index
Constructs an empty selection range.
Constructs a new selection range containing only the index specified by the
topLeft
and the index
bottomRight
.
PySide2.QtCore.QItemSelectionRange.
bottom
(
)
¶
int
Returns the row index corresponding to the lowermost selected row in the selection range.
PySide2.QtCore.QItemSelectionRange.
bottomRight
(
)
¶
Returns the index for the item located at the bottom-right corner of the selection range.
PySide2.QtCore.QItemSelectionRange.
contains
(
index
)
¶
index
–
QModelIndex
bool
返回
true
if the model item specified by the
index
lies within the range of selected items; otherwise returns
false
.
PySide2.QtCore.QItemSelectionRange.
contains
(
row
,
column
,
parentIndex
)
¶
row
–
int
column
–
int
parentIndex
–
QModelIndex
bool
这是重载函数。
返回
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
.
PySide2.QtCore.QItemSelectionRange.
height
(
)
¶
int
Returns the number of selected rows in the selection range.
PySide2.QtCore.QItemSelectionRange.
indexes
(
)
¶
QModelIndexList
Returns the list of model index items stored in the selection.
PySide2.QtCore.QItemSelectionRange.
intersected
(
other
)
¶
other
–
QItemSelectionRange
Returns a new selection range containing only the items that are found in both the selection range and the
other
selection range.
PySide2.QtCore.QItemSelectionRange.
intersects
(
other
)
¶
other
–
QItemSelectionRange
bool
返回
true
if this selection range intersects (overlaps with) the
other
range given; otherwise returns
false
.
PySide2.QtCore.QItemSelectionRange.
isEmpty
(
)
¶
bool
返回
true
if the selection range contains no selectable item
PySide2.QtCore.QItemSelectionRange.
isValid
(
)
¶
bool
返回
true
if the selection range is valid; otherwise returns
false
.
PySide2.QtCore.QItemSelectionRange.
left
(
)
¶
int
Returns the column index corresponding to the leftmost selected column in the selection range.
PySide2.QtCore.QItemSelectionRange.
model
(
)
¶
Returns the model that the items in the selection range belong to.
PySide2.QtCore.QItemSelectionRange.
__ne__
(
other
)
¶
other
–
QItemSelectionRange
bool
返回
true
if the selection range differs from the
other
range given; otherwise returns
false
.
PySide2.QtCore.QItemSelectionRange.
__lt__
(
other
)
¶
other
–
QItemSelectionRange
bool
PySide2.QtCore.QItemSelectionRange.
__eq__
(
other
)
¶
other
–
QItemSelectionRange
bool
返回
true
if the selection range is exactly the same as the
other
range given; otherwise returns
false
.
PySide2.QtCore.QItemSelectionRange.
parent
(
)
¶
Returns the parent model item index of the items in the selection range.
PySide2.QtCore.QItemSelectionRange.
right
(
)
¶
int
Returns the column index corresponding to the rightmost selected column in the selection range.
PySide2.QtCore.QItemSelectionRange.
swap
(
other
)
¶
other
–
QItemSelectionRange
Swaps this selection range’s contents with
other
。此函数非常快,且从不失败。
PySide2.QtCore.QItemSelectionRange.
top
(
)
¶
int
Returns the row index corresponding to the uppermost selected row in the selection range.
PySide2.QtCore.QItemSelectionRange.
topLeft
(
)
¶
Returns the index for the item located at the top-left corner of the selection range.
另请参阅
PySide2.QtCore.QItemSelectionRange.
width
(
)
¶
int
Returns the number of selected columns in the selection range.