Qt 4.8
|
The QPersistentModelIndex class is used to locate data in a data model. More...
#include <qabstractitemmodel.h>
Public Functions | |
QModelIndex | child (int row, int column) const |
Returns the child of the model index that is stored in the given row and column. More... | |
int | column () const |
Returns the column this persistent model index refers to. More... | |
QVariant | data (int role=Qt::DisplayRole) const |
Returns the data for the given role for the item referred to by the index. More... | |
Qt::ItemFlags | flags () const |
Returns the flags for the item referred to by the index. More... | |
qint64 | internalId () const |
void * | internalPointer () const |
bool | isValid () const |
Returns true if this persistent model index is valid; otherwise returns false. More... | |
const QAbstractItemModel * | model () const |
Returns the model that the index belongs to. More... | |
operator const QModelIndex & () const | |
Cast operator that returns a const QModelIndex&. More... | |
bool | operator!= (const QPersistentModelIndex &other) const |
Returns true if this persistent model index is not equal to the other persistent model index; otherwise returns false. More... | |
bool | 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. More... | |
bool | operator< (const QPersistentModelIndex &other) const |
Returns true if this persistent model index is smaller than the other persistent model index; otherwise returns false. More... | |
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. More... | |
QPersistentModelIndex & | operator= (const QModelIndex &other) |
Sets the persistent model index to refer to the same item in a model as the other model index. More... | |
bool | operator== (const QPersistentModelIndex &other) const |
Returns true if this persistent model index is equal to the other persistent model index; otherwise returns false. More... | |
bool | 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. More... | |
QModelIndex | parent () const |
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent. More... | |
QPersistentModelIndex () | |
QPersistentModelIndex (const QModelIndex &index) | |
Creates a new QPersistentModelIndex that is a copy of the model index. More... | |
QPersistentModelIndex (const QPersistentModelIndex &other) | |
Creates a new QPersistentModelIndex that is a copy of the other persistent model index. More... | |
int | row () const |
Returns the row this persistent model index refers to. More... | |
QModelIndex | 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. More... | |
~QPersistentModelIndex () | |
Properties | |
QPersistentModelIndexData * | d |
Friends | |
Q_CORE_EXPORT QDebug | operator<< (QDebug, const QPersistentModelIndex &) |
uint | qHash (const QPersistentModelIndex &) |
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.
Definition at line 107 of file qabstractitemmodel.h.
QPersistentModelIndex::QPersistentModelIndex | ( | ) |
Definition at line 118 of file qabstractitemmodel.cpp.
QPersistentModelIndex::QPersistentModelIndex | ( | const QModelIndex & | index | ) |
Creates a new QPersistentModelIndex that is a copy of the model index.
Definition at line 143 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 133 of file qabstractitemmodel.cpp.
QPersistentModelIndex::~QPersistentModelIndex | ( | ) |
Definition at line 158 of file qabstractitemmodel.cpp.
QModelIndex QPersistentModelIndex::child | ( | int | row, |
int | column | ||
) | const |
Returns the child of the model index that is stored in the given row and column.
Definition at line 399 of file qabstractitemmodel.cpp.
int QPersistentModelIndex::column | ( | ) | const |
Returns the column this persistent model index refers to.
Definition at line 326 of file qabstractitemmodel.cpp.
Referenced by QDataWidgetMapperPrivate::currentIdx(), QAbstractItemModelPrivate::movePersistentIndexes(), QItemSelectionRange::operator<(), and QItemSelectionModel::setCurrentIndex().
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 412 of file qabstractitemmodel.cpp.
Referenced by QAbstractItemModelPrivate::columnsAboutToBeInserted(), QAbstractItemModelPrivate::columnsAboutToBeRemoved(), QAbstractItemModelPrivate::columnsInserted(), QAbstractItemModelPrivate::columnsRemoved(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QAbstractItemModelPrivate::movePersistentIndexes(), QDataWidgetMapperPrivate::populate(), QSidebar::removeEntry(), QAbstractItemModelPrivate::rowsAboutToBeInserted(), QAbstractItemModelPrivate::rowsAboutToBeRemoved(), QAbstractItemModelPrivate::rowsInserted(), and QAbstractItemModelPrivate::rowsRemoved().
Qt::ItemFlags QPersistentModelIndex::flags | ( | ) | const |
Returns the flags for the item referred to by the index.
Definition at line 427 of file qabstractitemmodel.cpp.
Referenced by QAccessibleItemRow::state().
qint64 QPersistentModelIndex::internalId | ( | ) | const |
Returns a qint64
used by the model to associate the index with the internal data structure.
Definition at line 358 of file qabstractitemmodel.cpp.
void * QPersistentModelIndex::internalPointer | ( | ) | const |
Returns a void
*
pointer used by the model to associate the index with the internal data structure.
Definition at line 342 of file qabstractitemmodel.cpp.
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 459 of file qabstractitemmodel.cpp.
Referenced by QListWidgetPrivate::_q_emitCurrentItemChanged(), QAbstractItemViewPrivate::checkMouseMove(), QDataWidgetMapperPrivate::commit(), QAccessibleItemRow::isValid(), QAbstractItemView::keyPressEvent(), QTreeView::mouseDoubleClickEvent(), QAbstractItemView::mouseMoveEvent(), QAbstractItemView::mousePressEvent(), QAbstractItemView::mouseReleaseEvent(), and QAccessibleItemRow::rect().
const QAbstractItemModel * QPersistentModelIndex::model | ( | ) | const |
Returns the model that the index belongs to.
Definition at line 437 of file qabstractitemmodel.cpp.
Referenced by QAccessibleItemRow::children(), QItemSelectionRange::operator<(), and QAccessibleItemRow::rect().
QPersistentModelIndex::operator const QModelIndex & | ( | ) | const |
Cast operator that returns a const QModelIndex&.
Definition at line 256 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 116 of file qabstractitemmodel.h.
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 294 of file qabstractitemmodel.cpp.
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.
Definition at line 194 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 218 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 234 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.
All values in the persistent model index are used when comparing with another persistent model index.
Definition at line 174 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.
All values in the persistent model index are used when comparing with another model index.
Definition at line 277 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 371 of file qabstractitemmodel.cpp.
Referenced by QAccessibleItemRow::children(), QAbstractItemModelPrivate::columnsAboutToBeInserted(), QAbstractItemModelPrivate::columnsInserted(), QAbstractItemModelPrivate::columnsRemoved(), QAbstractItemModelPrivate::itemsAboutToBeMoved(), QAccessibleItemRow::navigate(), QItemSelectionRange::operator<(), QAccessibleItemRow::rect(), QAbstractItemModelPrivate::rowsAboutToBeInserted(), QAbstractItemModelPrivate::rowsInserted(), QAbstractItemModelPrivate::rowsRemoved(), QItemSelectionModel::setCurrentIndex(), QAccessibleItemRow::state(), and QAccessibleItemRow::text().
int QPersistentModelIndex::row | ( | ) | const |
Returns the row this persistent model index refers to.
Definition at line 310 of file qabstractitemmodel.cpp.
Referenced by QListWidgetPrivate::_q_emitCurrentItemChanged(), QComboBoxPrivate::_q_modelReset(), QAccessibleItemRow::children(), QDataWidgetMapperPrivate::currentIdx(), QListWidget::dropEvent(), QTreeWidget::dropEvent(), QAbstractItemModelPrivate::movePersistentIndexes(), QAccessibleItemRow::navigate(), ModelIndexIterator::next(), QItemSelectionRange::operator<(), QAccessibleItemRow::rect(), QSidebar::removeEntry(), QItemSelectionModel::setCurrentIndex(), QAccessibleItemRow::setText(), QAccessibleItemRow::state(), QAccessibleItemRow::text(), and QAccessibleItemRow::text_helper().
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 385 of file qabstractitemmodel.cpp.
Referenced by QAccessibleItemRow::text().
|
friend |
Definition at line 478 of file qabstractitemmodel.cpp.
|
friend |
Definition at line 143 of file qabstractitemmodel.h.
|
private |
Definition at line 135 of file qabstractitemmodel.h.
Referenced by child(), column(), data(), flags(), internalId(), internalPointer(), isValid(), model(), operator const QModelIndex &(), operator!=(), operator<(), operator<<(), operator=(), operator==(), parent(), qHash(), QPersistentModelIndex(), row(), sibling(), and ~QPersistentModelIndex().