QItemSelection Class
The QItemSelection class manages information about selected items in a model. More…
| Header | #include <QItemSelection> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Inherits | QList |
List of all members, including inherited members
Public Functions
| QItemSelection() | |
| QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight) | |
| void | select(const QModelIndex &topLeft, const QModelIndex &bottomRight) |
| bool | contains(const QModelIndex &index) const |
| QModelIndexList | indexes() const |
| void | merge(const QItemSelection &other, int command) |
Static Public Members
| void | split(const QItemSelectionRange &range, const QItemSelectionRange &other, QItemSelection *result) |
Detailed Description
A QItemSelection is a list of QItemSelectionRange objects. select() adds a range, merge() combines selections and indexes() lists the selected items.
See also QItemSelectionRange and QItemSelectionModel.
Differences from Qt
merge() takes the command as an int, because QItemSelectionModel is declared after this class; QItemSelectionModel::SelectionFlags values convert to it. merge() and split() produce an equivalent but not necessarily identical set of ranges to Qt's.
Member Function Documentation
QItemSelection::QItemSelection()
Constructs an empty selection.
QItemSelection::QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Constructs a selection of the range from topLeft to bottomRight.
bool QItemSelection::contains(const QModelIndex &index) const
Returns true if index is selectable, enabled and inside one of the ranges; otherwise returns false.
QModelIndexList QItemSelection::indexes() const
Returns the selectable items of the selection, each once.
void QItemSelection::merge(const QItemSelection &other, int command)
Merges other into this selection according to command, a combination of QItemSelectionModel::SelectionFlag values: Select adds its items, Deselect removes them and Toggle flips them.
void QItemSelection::select(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Adds the range from topLeft to bottomRight, which must have the same parent and model, to the selection.
void QItemSelection::split(const QItemSelectionRange &range, const QItemSelectionRange &other, QItemSelection *result)
Splits range by other and appends to result the ranges that hold the items of range that are not in other.