QPersistentModelIndex 類用於在數據模型中定位數據。 更多...
| 頭: | #include <QPersistentModelIndex> |
| 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 |
| QModelIndex | parent () const |
| int | row () const |
| QModelIndex | sibling (int row , int column ) const |
| void | swap (QPersistentModelIndex & other ) |
| const QModelIndex & | operator const 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 |
| uint | qHash (const QPersistentModelIndex & index , uint 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.
注意: You cannot store a QStandardItemModel 's QPersistentModelIndex in one of the model's items.
另請參閱 模型/視圖編程 , QModelIndex ,和 QAbstractItemModel .
Move-constructs a QPersistentModelIndex instance, making it point at the same object that other 所指嚮的。
該函數在 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 模型索引。
移動賦值 other 到此 QPersistentModelIndex 實例。
該函數在 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.
返迴數據為給定 role 對於項引用通過索引。
另請參閱 Qt::ItemDataRole and QAbstractItemModel::setData ().
返迴由索引所引用的項標誌。
該函數在 Qt 4.2 引入。
返迴
true
若此持久模型索引有效;否則返迴
false
.
有效索引屬於模型,且擁有非負行號和列號。
另請參閱 model (), row (),和 column ().
返迴索引所屬的模型。
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
模型索引;否則返迴
false
.
返迴
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.
該函數在 Qt 4.1 引入。
返迴
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.
返迴
true
if this persistent model index refers to the same location as the
other
模型索引;否則返迴
false
.
The internal data pointer, row, column, and model 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 引入。