The QPersistentModelIndex class is used to locate data in a data model. 更多...
头: | #include <QPersistentModelIndex> |
qmake: | QT += core |
QPersistentModelIndex (const QModelIndex & index ) | |
QPersistentModelIndex (const QPersistentModelIndex & other ) | |
QPersistentModelIndex (QPersistentModelIndex && other ) | |
int | column () const |
QVariant | data (int role = Qt::DisplayRole) const |
Qt::ItemFlags | flags () const |
bool | isValid () const |
const QAbstractItemModel * | model () const |
QModelIndex | parent () const |
int | row () const |
QModelIndex | sibling (int row , int column ) const |
void | swap (QPersistentModelIndex & other ) |
operator const QModelIndex & () const | |
bool | operator!= (const QPersistentModelIndex & other ) const |
bool | operator!= (const QModelIndex & other ) const |
bool | operator< (const QPersistentModelIndex & other ) const |
QPersistentModelIndex & | operator= (const QPersistentModelIndex & other ) |
QPersistentModelIndex & | operator= (QPersistentModelIndex && other ) |
QPersistentModelIndex & | operator= (const QModelIndex & other ) |
bool | operator== (const QPersistentModelIndex & other ) const |
bool | operator== (const QModelIndex & other ) const |
uint | qHash (const QPersistentModelIndex & index , uint seed = 0) |
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.
另请参阅 模型/视图编程 , QModelIndex ,和 QAbstractItemModel .
创建新的 QPersistentModelIndex that is a copy of the model index .
创建新的 QPersistentModelIndex that is a copy of the other persistent model index.
移动构造 QPersistentModelIndex 实例,使之指向同一对象如 other 所指向的。
该函数在 Qt 5.2 引入。
Returns the column this persistent model index refers to.
返回数据为给定 role for the item referred to by the index.
另请参阅 Qt::ItemDataRole and QAbstractItemModel::setData ().
Returns the flags for the item referred to by the index.
该函数在 Qt 4.2 引入。
返回
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.
另请参阅 model (), row (),和 column ().
Returns the model that the index belongs to.
Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.
Returns the row this persistent model index refers to.
返回同级在 row and column or an invalid QModelIndex if there is no sibling at this position.
另请参阅 parent ().
Swaps this persistent modelindex with other 。此函数非常快且从不失败。
该函数在 Qt 5.0 引入。
Cast operator that returns a const QModelIndex &.
返回
true
if this persistent model index is not equal to the
other
persistent model index; otherwise returns
false
.
该函数在 Qt 4.2 引入。
返回
true
if this persistent model index does not refer to the same location as the
other
model index; otherwise returns
false
.
返回
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.
该函数在 Qt 4.1 引入。
Sets the persistent model index to refer to the same item in a model as the other persistent model index.
移动赋值 other 到此 QPersistentModelIndex 实例。
该函数在 Qt 5.2 引入。
Sets the persistent model index to refer to the same item in a model as the other model index.
返回
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.
返回
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.
Returns a hash of the QPersistentModelIndex index ,使用 seed 做计算种子。
该函数在 Qt 5.0 引入。