QPersistentModelIndex¶
The
QPersistentModelIndexclass is used to locate data in a data model. More…

Synopsis¶
Functions¶
def
__eq__(other)def
__eq__(other)def
__lt__(other)def
__ne__(other)def
__ne__(other)def
child(row, column)def
column()def
data([role=Qt.DisplayRole])def
flags()def
internalId()def
internalPointer()def
isValid()def
model()def
operator=(other)def
parent()def
row()def
sibling(row, column)def
swap(other)
Detailed Description¶
A
QPersistentModelIndexis a model index that can be stored by an application, and later used to access information in a model. Unlike theQModelIndexclass, it is safe to store aQPersistentModelIndexsince 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.
Note
You cannot store a
QStandardItemModel‘sQPersistentModelIndexin one of the model’s items.
- class PySide2.QtCore.QPersistentModelIndex¶
PySide2.QtCore.QPersistentModelIndex(index)
PySide2.QtCore.QPersistentModelIndex(other)
- Parameters:
index –
PySide2.QtCore.QModelIndex
- PySide2.QtCore.QPersistentModelIndex.child(row, column)¶
- Parameters:
row – int
column – int
- Return type:
Note
This function is deprecated.
Use
index()instead.Returns the child of the model index that is stored in the given
rowandcolumn.
- PySide2.QtCore.QPersistentModelIndex.column()¶
- Return type:
int
Returns the column this persistent model index refers to.
- PySide2.QtCore.QPersistentModelIndex.data([role=Qt.DisplayRole])¶
- Parameters:
role – int
- Return type:
object
Returns the data for the given
rolefor the item referred to by the index.See also
ItemDataRolesetData()
- PySide2.QtCore.QPersistentModelIndex.flags()¶
- Return type:
ItemFlags
Returns the flags for the item referred to by the index.
- PySide2.QtCore.QPersistentModelIndex.internalId()¶
- Return type:
quintptr
- PySide2.QtCore.QPersistentModelIndex.internalPointer()¶
- Return type:
void
- PySide2.QtCore.QPersistentModelIndex.isValid()¶
- Return type:
bool
Returns
trueif this persistent model index is valid; otherwise returnsfalse.A valid index belongs to a model, and has non-negative row and column numbers.
- PySide2.QtCore.QPersistentModelIndex.model()¶
- Return type:
Returns the model that the index belongs to.
- PySide2.QtCore.QPersistentModelIndex.__ne__(other)¶
- Parameters:
other –
PySide2.QtCore.QModelIndex- Return type:
bool
- PySide2.QtCore.QPersistentModelIndex.__ne__(other)
- Parameters:
- Return type:
bool
- PySide2.QtCore.QPersistentModelIndex.__lt__(other)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QPersistentModelIndex.operator=(other)
- Parameters:
other –
PySide2.QtCore.QModelIndex- Return type:
- PySide2.QtCore.QPersistentModelIndex.__eq__(other)¶
- Parameters:
other –
PySide2.QtCore.QModelIndex- Return type:
bool
- PySide2.QtCore.QPersistentModelIndex.__eq__(other)
- Parameters:
- Return type:
bool
- PySide2.QtCore.QPersistentModelIndex.parent()¶
- Return type:
Returns the parent
QModelIndexfor this persistent index, or an invalidQModelIndexif it has no parent.
- PySide2.QtCore.QPersistentModelIndex.row()¶
- Return type:
int
Returns the row this persistent model index refers to.
- PySide2.QtCore.QPersistentModelIndex.sibling(row, column)¶
- Parameters:
row – int
column – int
- Return type:
Returns the sibling at
rowandcolumnor an invalidQModelIndexif there is no sibling at this position.See also
- PySide2.QtCore.QPersistentModelIndex.swap(other)¶
- Parameters:
Swaps this persistent modelindex with
other. This function is very fast and never fails.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.