QItemSelection

Inheritance diagram of QItemSelection

Synopsis

Functions

Static functions

Detailed Description

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

class PySide.QtGui.QItemSelection
class PySide.QtGui.QItemSelection(QItemSelection)
class PySide.QtGui.QItemSelection(topLeft, bottomRight)
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 .

PySide.QtGui.QItemSelection.append(t)
Parameters:t
PySide.QtGui.QItemSelection.append(t)
Parameters:tPySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.at(i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.back()
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.clear()
PySide.QtGui.QItemSelection.contains(index)
Parameters:indexPySide.QtCore.QModelIndex
Return type:PySide.QtCore.bool

Returns true if the selection contains the given index ; otherwise returns false.

PySide.QtGui.QItemSelection.count()
Return type:PySide.QtCore.int
PySide.QtGui.QItemSelection.count(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:PySide.QtCore.int
PySide.QtGui.QItemSelection.detachShared()
PySide.QtGui.QItemSelection.detach_helper(alloc)
Parameters:allocPySide.QtCore.int
PySide.QtGui.QItemSelection.detach_helper()
PySide.QtGui.QItemSelection.empty()
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.endsWith(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.first()
Return type:PySide.QtGui.QItemSelectionRange
static PySide.QtGui.QItemSelection.fromSet(set)
Parameters:set
Return type:
static PySide.QtGui.QItemSelection.fromVector(vector)
Parameters:vector
Return type:
PySide.QtGui.QItemSelection.front()
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.indexOf(t[, from=0])
Parameters:
Return type:

PySide.QtCore.int

PySide.QtGui.QItemSelection.indexes()
Return type:

Returns a list of model indexes that correspond to the selected items.

PySide.QtGui.QItemSelection.insert(i, t)
Parameters:
PySide.QtGui.QItemSelection.isEmpty()
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.isSharedWith(other)
Parameters:other
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.last()
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.lastIndexOf(t[, from=-1])
Parameters:
Return type:

PySide.QtCore.int

PySide.QtGui.QItemSelection.length()
Return type:PySide.QtCore.int
PySide.QtGui.QItemSelection.merge(other, command)
Parameters:
PySide.QtGui.QItemSelection.mid(pos[, length=-1])
Parameters:
  • posPySide.QtCore.int
  • lengthPySide.QtCore.int
Return type:

PySide.QtGui.QItemSelection.move(from, to)
Parameters:
  • fromPySide.QtCore.int
  • toPySide.QtCore.int
PySide.QtGui.QItemSelection.__ne__(l)
Parameters:l
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.__add__(l)
Parameters:l
Return type:
PySide.QtGui.QItemSelection.__iadd__(l)
Parameters:l
Return type:
PySide.QtGui.QItemSelection.__iadd__(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:
PySide.QtGui.QItemSelection.__lshift__(l)
Parameters:l
Return type:
PySide.QtGui.QItemSelection.__lshift__(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:
PySide.QtGui.QItemSelection.__eq__(l)
Parameters:l
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.operator[](i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.pop_back()
PySide.QtGui.QItemSelection.pop_front()
PySide.QtGui.QItemSelection.prepend(t)
Parameters:tPySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.push_back(t)
Parameters:tPySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.push_front(t)
Parameters:tPySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.removeAll(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:PySide.QtCore.int
PySide.QtGui.QItemSelection.removeAt(i)
Parameters:iPySide.QtCore.int
PySide.QtGui.QItemSelection.removeFirst()
PySide.QtGui.QItemSelection.removeLast()
PySide.QtGui.QItemSelection.removeOne(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.replace(i, t)
Parameters:
PySide.QtGui.QItemSelection.reserve(size)
Parameters:sizePySide.QtCore.int
PySide.QtGui.QItemSelection.select(topLeft, bottomRight)
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.

PySide.QtGui.QItemSelection.setSharable(sharable)
Parameters:sharablePySide.QtCore.bool
PySide.QtGui.QItemSelection.size()
Return type:PySide.QtCore.int
static PySide.QtGui.QItemSelection.split(range, other, result)
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.

PySide.QtGui.QItemSelection.startsWith(t)
Parameters:tPySide.QtGui.QItemSelectionRange
Return type:PySide.QtCore.bool
PySide.QtGui.QItemSelection.swap(i, j)
Parameters:
  • iPySide.QtCore.int
  • jPySide.QtCore.int
PySide.QtGui.QItemSelection.takeAt(i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.takeFirst()
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.takeLast()
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.toSet()
Return type:
PySide.QtGui.QItemSelection.toVector()
Return type:
PySide.QtGui.QItemSelection.value(i)
Parameters:iPySide.QtCore.int
Return type:PySide.QtGui.QItemSelectionRange
PySide.QtGui.QItemSelection.value(i, defaultValue)
Parameters:
Return type:

PySide.QtGui.QItemSelectionRange