QItemSelectionRange Class
The QItemSelectionRange class manages information about a range of selected items in a model. More...
| Header: | #include <QItemSelectionRange> |
| qmake: | QT += core |
Public Functions
| QItemSelectionRange() | |
| QItemSelectionRange(const QItemSelectionRange &other) | |
| QModelIndexList | indexes() const |
| QItemSelectionRange | intersected(const QItemSelectionRange &other) const |
| bool | isEmpty() const |
| bool | isValid() const |
| bool | operator!=(const QItemSelectionRange &other) const |
(deprecated) bool | operator<(const QItemSelectionRange &other) const |
| bool | operator==(const QItemSelectionRange &other) const |
Detailed Description
The QItemSelectionRange class manages information about a range of selected items in a model.
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 QItemSelectionModel::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.
See also Model/View Programming, QAbstractItemModel, QItemSelection, and QItemSelectionModel.
Member Function Documentation
QItemSelectionRange::QItemSelectionRange()
Constructs an empty selection range.
QItemSelectionRange::QItemSelectionRange(const QItemSelectionRange &other)
Copy constructor. Constructs a new selection range with the same contents as the other range given.
QModelIndexList QItemSelectionRange::indexes() const
Returns the list of model index items stored in the selection.
QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &other) const
Returns a new selection range containing only the items that are found in both the selection range and the other selection range.
This function was introduced in Qt 4.2.
bool QItemSelectionRange::isEmpty() const
Returns true if the selection range contains no selectable item
This function was introduced in Qt 4.7.
bool QItemSelectionRange::isValid() const
Returns true if the selection range is valid; otherwise returns false.
bool QItemSelectionRange::operator!=(const QItemSelectionRange &other) const
Returns true if the selection range differs from the other range given; otherwise returns false.
bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const
This function is deprecated.
Returns true if the selection range is less than the other range given; otherwise returns false.
The less than calculation is not directly useful to developers - the way that ranges with different parents compare is not defined. This operator only exists so that the class can be used with QMap.
bool QItemSelectionRange::operator==(const QItemSelectionRange &other) const
Returns true if the selection range is exactly the same as the other range given; otherwise returns false.