6.0.0-rc4Source

QItemSelectionRange Class

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

Header#include <QItemSelectionRange>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Public Functions

QItemSelectionRange()
QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR)
QItemSelectionRange(const QModelIndex &index)
voidswap(QItemSelectionRange &other)
inttop() const
intleft() const
intbottom() const
intright() const
intwidth() const
intheight() const
const QPersistentModelIndex &topLeft() const
const QPersistentModelIndex &bottomRight() const
QModelIndexparent() const
const QAbstractItemModel *model() const
boolcontains(const QModelIndex &index) const
boolcontains(int row, int column, const QModelIndex &parentIndex) const
boolintersects(const QItemSelectionRange &other) const
QItemSelectionRangeintersected(const QItemSelectionRange &other) const
boolisValid() const
boolisEmpty() const
QModelIndexListindexes() const

Detailed Description

A range is a rectangle of items under one parent, from topLeft() to bottomRight(). The corners are persistent indexes, so a range follows its items when rows and columns are inserted or removed.

See also QItemSelection and QItemSelectionModel.

Differences from Qt

None.

Member Function Documentation

QItemSelectionRange::QItemSelectionRange()

Constructs an empty range.

QItemSelectionRange::QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR)

Constructs a range from topL to bottomR, which must have the same parent.

[explicit] QItemSelectionRange::QItemSelectionRange(const QModelIndex &index)

Constructs a range that holds the single item index.

int QItemSelectionRange::bottom() const

Returns the row of the bottom of the range.

const QPersistentModelIndex & QItemSelectionRange::bottomRight() const

Returns the bottom-right corner of the range.

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

Returns true if index is inside the range; otherwise returns false.

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

This is an overloaded function.

Returns true if the item at row and column under parentIndex is inside the range.

int QItemSelectionRange::height() const

Returns the number of rows of the range.

QModelIndexList QItemSelectionRange::indexes() const

Returns the items of the range that are selectable and enabled.

QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &other) const

Returns the range of the items that this range and other share, or an empty range.

This function was introduced in 4.2.

bool QItemSelectionRange::intersects(const QItemSelectionRange &other) const

Returns true if this range and other share an item; otherwise returns false.

bool QItemSelectionRange::isEmpty() const

Returns true if the range is invalid or none of its items can be selected; otherwise returns false.

bool QItemSelectionRange::isValid() const

Returns true if both corners are valid and form a rectangle under one parent; otherwise returns false.

int QItemSelectionRange::left() const

Returns the column of the left side of the range.

const QAbstractItemModel * QItemSelectionRange::model() const

Returns the model of the range.

QModelIndex QItemSelectionRange::parent() const

Returns the parent of the items in the range.

Returns the column of the right side of the range.

void QItemSelectionRange::swap(QItemSelectionRange &other)

Swaps this range with other.

int QItemSelectionRange::top() const

Returns the row of the top of the range.

const QPersistentModelIndex & QItemSelectionRange::topLeft() const

Returns the top-left corner of the range.

int QItemSelectionRange::width() const

Returns the number of columns of the range.