Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\inmodule QtCore More...
#include <qitemselectionmodel.h>
Public Member Functions | |
QItemSelectionRange ()=default | |
Constructs an empty selection range. | |
QItemSelectionRange (const QModelIndex &topL, const QModelIndex &bottomR) | |
Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight. | |
QItemSelectionRange (const QModelIndex &index) | |
Constructs a new selection range containing only the model item specified by the model index index. | |
void | swap (QItemSelectionRange &other) noexcept |
int | top () const |
Returns the row index corresponding to the uppermost selected row in the selection range. | |
int | left () const |
Returns the column index corresponding to the leftmost selected column in the selection range. | |
int | bottom () const |
Returns the row index corresponding to the lowermost selected row in the selection range. | |
int | right () const |
Returns the column index corresponding to the rightmost selected column in the selection range. | |
int | width () const |
Returns the number of selected columns in the selection range. | |
int | height () const |
Returns the number of selected rows in the selection range. | |
const QPersistentModelIndex & | topLeft () const |
Returns the index for the item located at the top-left corner of the selection range. | |
const QPersistentModelIndex & | bottomRight () const |
Returns the index for the item located at the bottom-right corner of the selection range. | |
QModelIndex | parent () const |
Returns the parent model item index of the items in the selection range. | |
const QAbstractItemModel * | model () const |
Returns the model that the items in the selection range belong to. | |
bool | 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 | contains (int row, int column, const QModelIndex &parentIndex) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 . | |
bool | intersects (const QItemSelectionRange &other) const |
Returns true if this selection range intersects (overlaps with) the other range given; otherwise returns false . | |
QItemSelectionRange | intersected (const QItemSelectionRange &other) const |
bool | isValid () const |
Returns true if the selection range is valid; otherwise returns false . | |
bool | isEmpty () const |
Returns true if the selection range contains either no items or only items which are either disabled or marked as not selectable. | |
QModelIndexList | indexes () const |
Returns the list of model index items stored in the selection. | |
Friends | |
bool | comparesEqual (const QItemSelectionRange &lhs, const QItemSelectionRange &rhs) noexcept |
\inmodule QtCore
The QItemSelectionRange class manages information about a range of selected items in a model.
\compares equality
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 \l{Model/View Classes} and is part of Qt's \l{Model/View Programming}{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.
Definition at line 17 of file qitemselectionmodel.h.
|
default |
Constructs an empty selection range.
Referenced by intersected().
|
inline |
Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight.
Definition at line 22 of file qitemselectionmodel.h.
|
inlineexplicit |
Constructs a new selection range containing only the model item specified by the model index index.
Definition at line 23 of file qitemselectionmodel.h.
|
inline |
Returns the row index corresponding to the lowermost selected row in the selection range.
Definition at line 33 of file qitemselectionmodel.h.
Referenced by QItemSelectionModelPrivate::expandSelection(), intersected(), and isEmpty().
|
inline |
Returns the index for the item located at the bottom-right corner of the selection range.
Definition at line 39 of file qitemselectionmodel.h.
Referenced by intersected().
|
inline |
Returns true
if the model item specified by the index lies within the range of selected items; otherwise returns false
.
Definition at line 43 of file qitemselectionmodel.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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
.
Definition at line 50 of file qitemselectionmodel.h.
References QModelIndex::row().
|
inline |
Returns the number of selected rows in the selection range.
Definition at line 36 of file qitemselectionmodel.h.
QModelIndexList QItemSelectionRange::indexes | ( | ) | const |
Returns the list of model index items stored in the selection.
Definition at line 317 of file qitemselectionmodel.cpp.
References indexesFromRange().
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.
Definition at line 206 of file qitemselectionmodel.cpp.
References QItemSelectionRange(), bottom(), bottomRight(), QAbstractItemModel::index(), left(), model(), other(), parent(), qMax(), qMin(), right(), top(), and topLeft().
Referenced by QQmlItemSelectionRangeValueType::intersected().
bool QItemSelectionRange::intersects | ( | const QItemSelectionRange & | other | ) | const |
Returns true
if this selection range intersects (overlaps with) the other range given; otherwise returns false
.
Definition at line 185 of file qitemselectionmodel.cpp.
References model, and other().
Referenced by QItemSelectionModel::emitSelectionChanged().
bool QItemSelectionRange::isEmpty | ( | ) | const |
Returns true
if the selection range contains either no items or only items which are either disabled or marked as not selectable.
Definition at line 298 of file qitemselectionmodel.cpp.
References bottom(), QAbstractItemModel::index(), isSelectableAndEnabled(), isValid(), left(), model(), parent(), right(), and top().
|
inline |
Returns true
if the selection range is valid; otherwise returns false
.
Definition at line 66 of file qitemselectionmodel.h.
Referenced by isEmpty().
|
inline |
Returns the column index corresponding to the leftmost selected column in the selection range.
Definition at line 32 of file qitemselectionmodel.h.
Referenced by QItemSelectionModelPrivate::expandSelection(), intersected(), and isEmpty().
|
inline |
Returns the model that the items in the selection range belong to.
Definition at line 41 of file qitemselectionmodel.h.
Referenced by intersected(), and isEmpty().
|
inline |
Returns the parent model item index of the items in the selection range.
Definition at line 40 of file qitemselectionmodel.h.
References QModelIndex::parent().
Referenced by QItemSelectionModelPrivate::expandSelection(), intersected(), and isEmpty().
|
inline |
Returns the column index corresponding to the rightmost selected column in the selection range.
Definition at line 34 of file qitemselectionmodel.h.
Referenced by QItemSelectionModelPrivate::expandSelection(), intersected(), and isEmpty().
|
inlinenoexcept |
Swaps this selection range's contents with other. This function is very fast and never fails.
Definition at line 25 of file qitemselectionmodel.h.
References other().
|
inline |
Returns the row index corresponding to the uppermost selected row in the selection range.
Definition at line 31 of file qitemselectionmodel.h.
Referenced by QItemSelectionModelPrivate::expandSelection(), intersected(), and isEmpty().
|
inline |
Returns the index for the item located at the top-left corner of the selection range.
Definition at line 38 of file qitemselectionmodel.h.
Referenced by intersected().
|
inline |
Returns the number of selected columns in the selection range.
Definition at line 35 of file qitemselectionmodel.h.
|
friend |
Definition at line 77 of file qitemselectionmodel.h.