Skip to content

PythonQt.QtGui.QItemSelection

QItemSelection

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A QItemSelection describes the items in a model that have been selected by the user. A QItemSelection is basically a list of selection ranges, see QItemSelectionRange. It provides functions for creating and manipulating selections, and selecting a range of items from a model.

The 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.

QItemSelection *selection = new 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:

QItemSelection *selection = new QItemSelection();
...
selection->select(topLeft, bottomRight);

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 merge() to merge one item selection into another without making overlapping ranges. Use split() to split one selection range into smaller ranges based on a another selection range.

Source: https://doc.qt.io/archives/qt-5.15/qitemselection.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
append function (self, t: Any) -> None
at function (self, i: int) -> Any X.at(i) -> PythonQt.QtGui.QItemSelectionRange
back function (self) -> Any X.back() -> PythonQt.QtGui.QItemSelectionRange
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clear function (self) -> None
constFirst function (self) -> Any X.constFirst() -> PythonQt.QtGui.QItemSelectionRange
constLast function (self) -> Any X.constLast() -> PythonQt.QtGui.QItemSelectionRange
contains function (self, index: Any) -> bool X.contains(index) -> bool
count function (self, t: Any) -> int X.count(t) -> int
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
detachShared function (self) -> None
empty function (self) -> bool X.empty() -> bool
endsWith function (self, t: Any) -> bool X.endsWith(t) -> bool
first function (self) -> Any X.first() -> PythonQt.QtGui.QItemSelectionRange
fromVector function (self, vector: Any) -> tuple X.fromVector(vector) -> tuple
front function (self) -> Any X.front() -> PythonQt.QtGui.QItemSelectionRange
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
indexOf function (self, *args: Any, **kwargs: Any) -> int X.indexOf(t, from) -> int
indexes function (self) -> tuple X.indexes() -> tuple
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isEmpty function (self) -> bool X.isEmpty() -> bool
isSharedWith function (self, other: Any) -> bool X.isSharedWith(other) -> bool
last function (self) -> Any X.last() -> PythonQt.QtGui.QItemSelectionRange
lastIndexOf function (self, *args: Any, **kwargs: Any) -> int X.lastIndexOf(t, from) -> int
length function (self) -> int X.length() -> int
merge function (self, other: Any, command: Any) -> None X.merge(other, command)
mid function (self, pos: int, length: int) -> tuple X.mid(pos, length) -> tuple
move function (self, *args: Any, **kwargs: Any) -> None X.move(from, to)
pop_back function (self) -> None
pop_front function (self) -> None
prepend function (self, t: Any) -> None
push_back function (self, t: Any) -> None
push_front function (self, t: Any) -> None
removeAll function (self, t: Any) -> int X.removeAll(t) -> int
removeAt function (self, i: int) -> None
removeFirst function (self) -> None
removeLast function (self) -> None
removeOne function (self, t: Any) -> bool X.removeOne(t) -> bool
replace function (self, i: int, t: Any) -> None X.replace(i, t)
reserve function (self, size: int) -> None
select function (self, topLeft: Any, bottomRight: Any) -> None X.select(topLeft, bottomRight)
setSharable function (self, sharable: bool) -> None
size function (self) -> int X.size() -> int
split function (self, range: Any, other: Any, result: Any) -> None X.split(range, other, result)
startsWith function (self, t: Any) -> bool X.startsWith(t) -> bool
swap function (self, i: Any, j: Any) -> None X.swap(i, j)
takeAt function (self, i: int) -> Any X.takeAt(i) -> PythonQt.QtGui.QItemSelectionRange
takeFirst function (self) -> Any X.takeFirst() -> PythonQt.QtGui.QItemSelectionRange
takeLast function (self) -> Any X.takeLast() -> PythonQt.QtGui.QItemSelectionRange
toVector function (self) -> tuple X.toVector() -> tuple
value function (self, i: int, defaultValue: Any) -> Any X.value(i, defaultValue) -> PythonQt.QtGui.QItemSelectionRange