The PySide.QtGui.QItemSelection class manages information about selected items in a model.
A PySide.QtGui.QItemSelection describes the items in a model that have been selected by the user. A PySide.QtGui.QItemSelection is basically a list of selection ranges, see PySide.QtGui.QItemSelectionRange . It provides functions for creating and manipulating selections, and selecting a range of items from a model.
The PySide.QtGui.QItemSelection class is one of the Model/View Classes and is part of Qt’s model/view framework .
An item selection can be constructed and initialized to contain a range of items from an existing model. The following example constructs a selection that contains a range of items from the given model , beginning at the topLeft , and ending at the bottomRight .
selection = QItemSelection(topLeft, bottomRight)An empty item selection can be constructed, and later populated as required. So, if the model is going to be unavailable when we construct the item selection, we can rewrite the above code in the following way:
selection = QItemSelection() ... selection.select(topLeft, bottomRight)PySide.QtGui.QItemSelection saves memory, and avoids unnecessary work, by working with selection ranges rather than recording the model item index for each item in the selection. Generally, an instance of this class will contain a list of non-overlapping selection ranges.
Use PySide.QtGui.QItemSelection.merge() to merge one item selection into another without making overlapping ranges. Use PySide.QtGui.QItemSelection.split() to split one selection range into smaller ranges based on a another selection range.
See also
Model/View Programming PySide.QtGui.QItemSelectionModel
Parameters: |
|
---|
Constructs an empty selection.
Constructs an item selection that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight .
Parameters: | t – |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QItemSelectionRange |
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Parameters: | index – PySide.QtCore.QModelIndex |
---|---|
Return type: | PySide.QtCore.bool |
Returns true if the selection contains the given index ; otherwise returns false.
Return type: | PySide.QtCore.int |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: | PySide.QtCore.int |
Parameters: | alloc – PySide.QtCore.int |
---|
Return type: | PySide.QtCore.bool |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: | PySide.QtCore.bool |
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Parameters: | set – |
---|---|
Return type: |
Parameters: | vector – |
---|---|
Return type: |
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Return type: |
---|
Returns a list of model indexes that correspond to the selected items.
Parameters: |
|
---|
Return type: | PySide.QtCore.bool |
---|
Parameters: | other – |
---|---|
Return type: | PySide.QtCore.bool |
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Return type: | PySide.QtCore.int |
---|
Parameters: |
|
---|
Parameters: |
|
---|---|
Return type: |
Parameters: |
|
---|
Parameters: | l – |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: | l – |
---|---|
Return type: |
Parameters: | l – |
---|---|
Return type: |
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: |
Parameters: | l – |
---|---|
Return type: |
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: |
Parameters: | l – |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QItemSelectionRange |
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: | PySide.QtCore.int |
Parameters: | i – PySide.QtCore.int |
---|
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: |
|
---|
Parameters: | size – PySide.QtCore.int |
---|
Parameters: |
|
---|
Adds the items in the range that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight to the list.
Note
topLeft and bottomRight must have the same parent.
Parameters: | sharable – PySide.QtCore.bool |
---|
Return type: | PySide.QtCore.int |
---|
Parameters: |
|
---|
Splits the selection range using the selection other range. Removes all items in other from range and puts the result in result . This can be compared with the semantics of the subtract operation of a set.
See also
Parameters: | t – PySide.QtGui.QItemSelectionRange |
---|---|
Return type: | PySide.QtCore.bool |
Parameters: |
|
---|
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QItemSelectionRange |
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Return type: | PySide.QtGui.QItemSelectionRange |
---|
Return type: |
---|
Return type: |
---|
Parameters: | i – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QItemSelectionRange |
Parameters: |
|
---|---|
Return type: |