QPersistentModelIndex

The QPersistentModelIndex class is used to locate data in a data model. More

Inheritance diagram of PySide2.QtCore.QPersistentModelIndex

Synopsis

Functions

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 PySide2.QtCore.QPersistentModelIndex

PySide2.QtCore.QPersistentModelIndex(index)

PySide2.QtCore.QPersistentModelIndex(other)

Parameters:
PySide2.QtCore.QPersistentModelIndex.child(row, column)
Parameters:
  • row – int

  • column – int

Return type:

PySide2.QtCore.QModelIndex

Note

This function is deprecated.

Use index() instead.

Returns the child of the model index that is stored in the given row and column .

See also

parent() sibling()

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 role for the item referred to by the index.

See also

ItemDataRole setData()

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 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.

PySide2.QtCore.QPersistentModelIndex.model()
Return type:

PySide2.QtCore.QAbstractItemModel

Returns the model that the index belongs to.

PySide2.QtCore.QPersistentModelIndex.__ne__(other)
Parameters:

otherPySide2.QtCore.QModelIndex

Return type:

bool

PySide2.QtCore.QPersistentModelIndex.__ne__(other)
Parameters:

otherPySide2.QtCore.QPersistentModelIndex

Return type:

bool

PySide2.QtCore.QPersistentModelIndex.__lt__(other)
Parameters:

otherPySide2.QtCore.QPersistentModelIndex

Return type:

bool

PySide2.QtCore.QPersistentModelIndex.operator=(other)
Parameters:

otherPySide2.QtCore.QModelIndex

Return type:

PySide2.QtCore.QPersistentModelIndex

PySide2.QtCore.QPersistentModelIndex.__eq__(other)
Parameters:

otherPySide2.QtCore.QModelIndex

Return type:

bool

PySide2.QtCore.QPersistentModelIndex.__eq__(other)
Parameters:

otherPySide2.QtCore.QPersistentModelIndex

Return type:

bool

PySide2.QtCore.QPersistentModelIndex.parent()
Return type:

PySide2.QtCore.QModelIndex

Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent.

See also

sibling() model()

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:

PySide2.QtCore.QModelIndex

Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.

See also

parent()

PySide2.QtCore.QPersistentModelIndex.swap(other)
Parameters:

otherPySide2.QtCore.QPersistentModelIndex

Swaps this persistent modelindex with other . This function is very fast and never fails.