QItemSelectionRange Class | Qt Core 5.15.19 (original) (raw)

The QItemSelectionRange class manages information about a range of selected items in a model. More...

Member Function Documentation

QItemSelectionRange::QItemSelectionRange(const QModelIndex &index)

Constructs a new selection range containing only the model item specified by the model index index.

QItemSelectionRange::QItemSelectionRange(const QModelIndex &topLeft, const QModelIndex &bottomRight)

Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight.

QItemSelectionRange::QItemSelectionRange(const QItemSelectionRange &other)

Copy constructor. Constructs a new selection range with the same contents as the other range given.

QItemSelectionRange::QItemSelectionRange()

Constructs an empty selection range.

int QItemSelectionRange::bottom() const

Returns the row index corresponding to the lowermost selected row in the selection range.

const QPersistentModelIndex &QItemSelectionRange::bottomRight() const

Returns the index for the item located at the bottom-right corner of the selection range.

See also bottom(), right(), and topLeft().

bool QItemSelectionRange::contains(const QModelIndex &index) const

Returns true if the model item specified by the index lies within the range of selected items; otherwise returns false.

bool QItemSelectionRange::contains(int row, int column, const QModelIndex &parentIndex) const

This is an overloaded function.

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

int QItemSelectionRange::height() const

Returns the number of selected rows in the selection range.

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::intersects(const QItemSelectionRange &other) const

Returns true if this selection range intersects (overlaps with) the other range given; otherwise returns false.

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.

int QItemSelectionRange::left() const

Returns the column index corresponding to the leftmost selected column in the selection range.

const QAbstractItemModel *QItemSelectionRange::model() const

Returns the model that the items in the selection range belong to.

QModelIndex QItemSelectionRange::parent() const

Returns the parent model item index of the items in the selection range.

int QItemSelectionRange::right() const

Returns the column index corresponding to the rightmost selected column in the selection range.

void QItemSelectionRange::swap(QItemSelectionRange &other)

Swaps this selection range's contents with other. This function is very fast and never fails.

This function was introduced in Qt 5.6.

int QItemSelectionRange::top() const

Returns the row index corresponding to the uppermost selected row in the selection range.

const QPersistentModelIndex &QItemSelectionRange::topLeft() const

Returns the index for the item located at the top-left corner of the selection range.

See also top(), left(), and bottomRight().

int QItemSelectionRange::width() const

Returns the number of selected columns in the selection range.

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

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.