QPersistentModelIndex¶
The QPersistentModelIndex
class 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
column
()def
constInternalPointer
()def
data
([role=Qt.DisplayRole])def
flags
()def
internalId
()def
internalPointer
()def
isValid
()def
model
()def
parent
()def
row
()def
sibling
(row, column)def
swap
(other)
Detailed Description¶
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.
Note
You cannot store a QStandardItemModel
‘s QPersistentModelIndex
in one of the model’s items.
- class PySide6.QtCore.QPersistentModelIndex¶
PySide6.QtCore.QPersistentModelIndex(index)
PySide6.QtCore.QPersistentModelIndex(other)
- Parameters
index –
PySide6.QtCore.QModelIndex
Creates a new QPersistentModelIndex
that is a copy of the model index
.
- PySide6.QtCore.QPersistentModelIndex.column()¶
- Return type
int
Returns the column this persistent model index refers to.
- PySide6.QtCore.QPersistentModelIndex.constInternalPointer()¶
- Return type
void
- PySide6.QtCore.QPersistentModelIndex.data([role=Qt.DisplayRole])¶
- Parameters
role – int
- Return type
object
Returns the data for the given role
for the item referred to by the index.
See also
ItemDataRole
setData()
- PySide6.QtCore.QPersistentModelIndex.flags()¶
- Return type
ItemFlags
Returns the flags for the item referred to by the index.
- PySide6.QtCore.QPersistentModelIndex.internalId()¶
- Return type
quintptr
- PySide6.QtCore.QPersistentModelIndex.internalPointer()¶
- Return type
void
- PySide6.QtCore.QPersistentModelIndex.isValid()¶
- Return type
bool
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.
- PySide6.QtCore.QPersistentModelIndex.model()¶
- Return type
Returns the model that the index belongs to.
- PySide6.QtCore.QPersistentModelIndex.__ne__(other)¶
- Parameters
other –
PySide6.QtCore.QModelIndex
- Return type
bool
Returns true
if this persistent model index does not refer to the same location as the other
model index; otherwise returns false
.
- PySide6.QtCore.QPersistentModelIndex.__ne__(other)
- Parameters
- Return type
bool
Returns true
if this persistent model index is not equal to the other
persistent model index; otherwise returns false
.
- PySide6.QtCore.QPersistentModelIndex.__lt__(other)¶
- Parameters
- Return type
bool
- PySide6.QtCore.QPersistentModelIndex.__eq__(other)¶
- Parameters
other –
PySide6.QtCore.QModelIndex
- Return type
bool
Returns true
if this persistent model index refers to the same location as the other
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 model index.
- PySide6.QtCore.QPersistentModelIndex.__eq__(other)
- Parameters
- Return type
bool
Returns 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.
- PySide6.QtCore.QPersistentModelIndex.parent()¶
- Return type
Returns the parent QModelIndex
for this persistent index, or an invalid QModelIndex
if it has no parent.
- PySide6.QtCore.QPersistentModelIndex.row()¶
- Return type
int
Returns the row this persistent model index refers to.
- PySide6.QtCore.QPersistentModelIndex.sibling(row, column)¶
- Parameters
row – int
column – int
- Return type
Returns the sibling at row
and column
or an invalid QModelIndex
if there is no sibling at this position.
See also
- PySide6.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.