QtBase
v6.3.1
|
The QPersistentModelIndex class is used to locate data in a data model. More...
#include <qabstractitemmodel.h>
Friends | |
size_t | qHash (const QPersistentModelIndex &, size_t seed) noexcept |
bool | qHashEquals (const QPersistentModelIndex &a, const QPersistentModelIndex &b) noexcept |
Q_CORE_EXPORT QDebug | operator<< (QDebug, const QPersistentModelIndex &) |
Related Functions | |
(Note that these are not member functions.) | |
size_t | qHash (const QPersistentModelIndex &index, size_t seed=0) |
The QPersistentModelIndex class is used to locate data in a data model.
\inmodule QtCore
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.
Definition at line 210 of file qabstractitemmodel.h.
QPersistentModelIndex::QPersistentModelIndex | ( | ) |
Definition at line 365 of file qabstractitemmodel.cpp.
QPersistentModelIndex::QPersistentModelIndex | ( | const QModelIndex & | index | ) |
Creates a new QPersistentModelIndex that is a copy of the model index.
Definition at line 387 of file qabstractitemmodel.cpp.
QPersistentModelIndex::QPersistentModelIndex | ( | const QPersistentModelIndex & | other | ) |
Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
Definition at line 377 of file qabstractitemmodel.cpp.
QPersistentModelIndex::~QPersistentModelIndex | ( | ) |
Definition at line 402 of file qabstractitemmodel.cpp.
|
inlinenoexcept |
Move-constructs a QPersistentModelIndex instance, making it point at the same object that other was pointing to.
Definition at line 222 of file qabstractitemmodel.h.
int QPersistentModelIndex::column | ( | ) | const |
Returns the column this persistent model index refers to.
Definition at line 553 of file qabstractitemmodel.cpp.
Definition at line 585 of file qabstractitemmodel.cpp.
QVariant QPersistentModelIndex::data | ( | int | role = Qt::DisplayRole | ) | const |
Returns the data for the given role for the item referred to by the index.
Definition at line 641 of file qabstractitemmodel.cpp.
Qt::ItemFlags QPersistentModelIndex::flags | ( | ) | const |
Returns the flags for the item referred to by the index.
Definition at line 667 of file qabstractitemmodel.cpp.
quintptr QPersistentModelIndex::internalId | ( | ) | const |
Definition at line 601 of file qabstractitemmodel.cpp.
void * QPersistentModelIndex::internalPointer | ( | ) | const |
bool QPersistentModelIndex::isValid | ( | ) | const |
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.
Definition at line 696 of file qabstractitemmodel.cpp.
const QAbstractItemModel * QPersistentModelIndex::model | ( | ) | const |
Returns the model that the index belongs to.
Definition at line 677 of file qabstractitemmodel.cpp.
void QPersistentModelIndex::multiData | ( | QModelRoleDataSpan | roleDataSpan | ) | const |
Populates the given roleDataSpan for the item referred to by the index.
Definition at line 656 of file qabstractitemmodel.cpp.
QPersistentModelIndex::operator QModelIndex | ( | ) | const |
Cast operator that returns a QModelIndex.
Definition at line 498 of file qabstractitemmodel.cpp.
bool QPersistentModelIndex::operator!= | ( | const QModelIndex & | other | ) | const |
Returns {true} if this persistent model index does not refer to the same location as the other model index; otherwise returns
{false}.
Definition at line 527 of file qabstractitemmodel.cpp.
|
inline |
Returns {true} if this persistent model index is not equal to the other persistent model index; otherwise returns
{false}.
Definition at line 219 of file qabstractitemmodel.h.
bool QPersistentModelIndex::operator< | ( | const QPersistentModelIndex & | other | ) | const |
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.
Definition at line 435 of file qabstractitemmodel.cpp.
QPersistentModelIndex & QPersistentModelIndex::operator= | ( | const QModelIndex & | other | ) |
Sets the persistent model index to refer to the same item in a model as the other model index.
Definition at line 479 of file qabstractitemmodel.cpp.
QPersistentModelIndex & QPersistentModelIndex::operator= | ( | const QPersistentModelIndex & | other | ) |
Sets the persistent model index to refer to the same item in a model as the other persistent model index.
Definition at line 456 of file qabstractitemmodel.cpp.
bool QPersistentModelIndex::operator== | ( | const QModelIndex & | other | ) | const |
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.
Definition at line 513 of file qabstractitemmodel.cpp.
bool QPersistentModelIndex::operator== | ( | const QPersistentModelIndex & | other | ) | const |
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.
Definition at line 418 of file qabstractitemmodel.cpp.
QModelIndex QPersistentModelIndex::parent | ( | ) | const |
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
Definition at line 614 of file qabstractitemmodel.cpp.
int QPersistentModelIndex::row | ( | ) | const |
Returns the row this persistent model index refers to.
Definition at line 540 of file qabstractitemmodel.cpp.
QModelIndex QPersistentModelIndex::sibling | ( | int | row, |
int | column | ||
) | const |
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.
Definition at line 628 of file qabstractitemmodel.cpp.
|
inlinenoexcept |
Swaps this persistent modelindex with other. This function is very fast and never fails.
Definition at line 225 of file qabstractitemmodel.h.
|
friend |
Definition at line 710 of file qabstractitemmodel.cpp.
|
friend |
Returns a hash of the QPersistentModelIndex index, using seed to seed the calculation.
Definition at line 253 of file qabstractitemmodel.h.
|
related |
Returns a hash of the QPersistentModelIndex index, using seed to seed the calculation.
Definition at line 253 of file qabstractitemmodel.h.
|
friend |
Definition at line 245 of file qabstractitemmodel.h.