CopperSpice API
1.9.2
|
The QPersistentModelIndex class is used to locate data in a data model. More...
Public Methods | |
QPersistentModelIndex (const QModelIndex &index) | |
QPersistentModelIndex (const QPersistentModelIndex &other) | |
QPersistentModelIndex (QPersistentModelIndex &&other) | |
QModelIndex | child (int row, int column) const |
int | column () const |
QVariant | data (int role=Qt::DisplayRole) const |
Qt::ItemFlags | flags () const |
bool | isValid () const |
const QAbstractItemModel * | model () const |
operator const QModelIndex & () const | |
bool | operator!= (const QModelIndex &other) const |
bool | operator!= (const QPersistentModelIndex &other) const |
bool | operator< (const QPersistentModelIndex &other) const |
QPersistentModelIndex & | operator= (const QModelIndex &other) |
QPersistentModelIndex & | operator= (const QPersistentModelIndex &other) |
QPersistentModelIndex & | operator= (QPersistentModelIndex &&other) |
bool | operator== (const QModelIndex &other) const |
bool | operator== (const QPersistentModelIndex &other) const |
QModelIndex | parent () const |
int | row () const |
QModelIndex | sibling (int row, int column) const |
void | swap (QPersistentModelIndex &other) |
The QPersistentModelIndex class is used to locate data in a data model.
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.
QPersistentModelIndex::QPersistentModelIndex | ( | const QModelIndex & | index | ) |
Creates a new QPersistentModelIndex that is a copy of the model index.
QPersistentModelIndex::QPersistentModelIndex | ( | const QPersistentModelIndex & | other | ) |
Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
|
inline |
Move constructs a new QPersistentModelIndex from other.
QModelIndex QPersistentModelIndex::child | ( | int | row, |
int | column | ||
) | const |
int QPersistentModelIndex::column | ( | ) | const |
Returns the column this persistent model index refers to.
QVariant QPersistentModelIndex::data | ( | int | role = Qt::DisplayRole | ) | const |
Returns the data for the given role for the item referred to by the index.
Qt::ItemFlags QPersistentModelIndex::flags | ( | ) | const |
Returns the flags for the item referred to by the index.
bool QPersistentModelIndex::isValid | ( | ) | const |
const QAbstractItemModel * QPersistentModelIndex::model | ( | ) | const |
Returns the model that the index belongs to.
QPersistentModelIndex::operator const QModelIndex & | ( | ) | const |
Cast operator that returns a const QModelIndex&.
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.
|
inline |
Returns true if this persistent model index is not equal to the other persistent model index, otherwise returns false.
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.
All values in the persistent model index are used when comparing with another persistent model index.
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.
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.
|
inline |
Move assigns from other and returns a reference to this object.
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.
All values in the persistent model index are used when comparing with another model index.
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.
All values in the persistent model index are used when comparing with another persistent model index.
QModelIndex QPersistentModelIndex::parent | ( | ) | const |
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
int QPersistentModelIndex::row | ( | ) | const |
Returns the row this persistent model index refers to.
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.
|
inline |
Swaps this persistent modelindex with other. This method is very fast and never fails.