The QPersistentModelIndex class is used to locate data in a data model. More...
Header: | #include <QPersistentModelIndex> |
CMake: | find_package(Qt6 COMPONENTS Core REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
QPersistentModelIndex(QPersistentModelIndex &&other) | |
QPersistentModelIndex(const QPersistentModelIndex &other) | |
QPersistentModelIndex(const QModelIndex &index) | |
QPersistentModelIndex & | operator=(const QModelIndex &other) |
QPersistentModelIndex & | operator=(QPersistentModelIndex &&other) |
QPersistentModelIndex & | operator=(const QPersistentModelIndex &other) |
int | column() const |
QVariant | data(int role = Qt::DisplayRole) const |
Qt::ItemFlags | flags() const |
bool | isValid() const |
const QAbstractItemModel * | model() const |
void | multiData(QModelRoleDataSpan roleDataSpan) const |
QModelIndex | parent() const |
int | row() const |
QModelIndex | sibling(int row, int column) const |
void | swap(QPersistentModelIndex &other) |
QModelIndex | operator QModelIndex() const |
bool | operator!=(const QPersistentModelIndex &other) const |
bool | operator!=(const QModelIndex &other) const |
bool | operator<(const QPersistentModelIndex &other) const |
bool | operator==(const QPersistentModelIndex &other) const |
bool | operator==(const QModelIndex &other) const |
size_t | qHash(const QPersistentModelIndex &index, size_t seed = 0) |
A QPersistentModelIndex is a model index that can be stored by an application, and later used to access information in a model. Unlike the QModelIndex class, it is safe to store a QPersistentModelIndex since the model will ensure that references to items will continue to be valid as long as they can be accessed by the model.
It is good practice to check that persistent model indexes are valid before using them.
Note: You cannot store a QStandardItemModel's QPersistentModelIndex in one of the model's items.
See also Model/View Programming, QModelIndex, and QAbstractItemModel.
[since 5.2]
QPersistentModelIndex::QPersistentModelIndex(QPersistentModelIndex &&other)
Move-constructs a QPersistentModelIndex instance, making it point at the same object that other was pointing to.
This function was introduced in Qt 5.2.
Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
Creates a new QPersistentModelIndex that is a copy of the model index.
Sets the persistent model index to refer to the same item in a model as the other model index.
[since 5.2]
QPersistentModelIndex &QPersistentModelIndex::operator=(QPersistentModelIndex &&other)
Move-assigns other to this QPersistentModelIndex instance.
This function was introduced in Qt 5.2.
Sets the persistent model index to refer to the same item in a model as the other persistent model index.
Returns the column this persistent model index refers to.
Returns the data for the given role for the item referred to by the index.
See also Qt::ItemDataRole and QAbstractItemModel::setData().
Returns the flags for the item referred to by the index.
Returns true
if this persistent model index is valid; otherwise returns false
.
A valid index belongs to a model, and has non-negative row and column numbers.
See also model(), row(), and column().
Returns the model that the index belongs to.
[since 6.0]
void QPersistentModelIndex::multiData(QModelRoleDataSpan roleDataSpan) const
Populates the given roleDataSpan for the item referred to by the index.
This function was introduced in Qt 6.0.
See also Qt::ItemDataRole and QAbstractItemModel::setData().
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
See also sibling() and model().
Returns the row this persistent model index refers to.
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.
See also parent().
[since 5.0]
void QPersistentModelIndex::swap(QPersistentModelIndex &other)
Swaps this persistent modelindex with other. This function is very fast and never fails.
This function was introduced in Qt 5.0.
Cast operator that returns a QModelIndex.
Returns true
if this persistent model index is not equal to the other persistent model index; otherwise returns false
.
Returns true
if this persistent model index does not refer to the same location as the other model index; otherwise returns false
.
Returns true
if this persistent model index is smaller than the other persistent model index; otherwise returns false
.
The internal data pointer, row, column, and model values in the persistent model index are used when comparing with another persistent model index.
Returns true
if this persistent model index is equal to the other persistent model index; otherwise returns false
.
The internal data pointer, row, column, and model values in the persistent model index are used when comparing with another persistent model index.
Returns true
if this persistent model index refers to the same location as the other model index; otherwise returns false
.
The internal data pointer, row, column, and model values in the persistent model index are used when comparing with another model index.
[since 5.0]
size_t qHash(const QPersistentModelIndex &index, size_t seed = 0)
Returns a hash of the QPersistentModelIndex index, using seed to seed the calculation.
This function was introduced in Qt 5.0.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qpersistentmodelindex.html