QPersistentModelIndex Class Reference

[ QtCore module]

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

方法

Special Methods


详细描述

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


方法文档编制

QPersistentModelIndex.__init__ ( self )

创建新的 QPersistentModelIndex that is a copy of the model index .

QPersistentModelIndex.__init__ ( self , QModelIndex   index )

QPersistentModelIndex.__init__ ( self , QPersistentModelIndex   other )

创建新的 QPersistentModelIndex that is a copy of the other persistent model index.

QModelIndex QPersistentModelIndex.child ( self , int  row , int  column )

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

另请参阅 parent () 和 sibling ().

int QPersistentModelIndex.column ( self )

Returns the column this persistent model index refers to.

QVariant QPersistentModelIndex.data ( self , int  role  = Qt.DisplayRole)

返回数据为给定 role for the item referred to by the index.

另请参阅 Qt.ItemDataRole and QAbstractItemModel.setData ().

Qt.ItemFlags QPersistentModelIndex.flags ( self )

Returns the flags for the item referred to by the index.

该函数在 Qt 4.2 引入。

bool QPersistentModelIndex.isValid ( self )

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.

另请参阅 model (), row (),和 column ().

QAbstractItemModel QPersistentModelIndex.model ( self )

Returns the model that the index belongs to.

QModelIndex QPersistentModelIndex.parent ( self )

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

另请参阅 child (), sibling (),和 model ().

int QPersistentModelIndex.row ( self )

Returns the row this persistent model index refers to.

QModelIndex QPersistentModelIndex.sibling ( self , int  row , int  column )

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

另请参阅 parent () 和 child ().

bool QPersistentModelIndex.__eq__ ( self , QPersistentModelIndex   other )

bool QPersistentModelIndex.__eq__ ( self , QModelIndex   other )

bool QPersistentModelIndex.__ge__ ( self , QPersistentModelIndex   other )

int QPersistentModelIndex.__hash__ ( self )

bool QPersistentModelIndex.__lt__ ( self , QPersistentModelIndex   other )

bool QPersistentModelIndex.__ne__ ( self , QPersistentModelIndex   other )

bool QPersistentModelIndex.__ne__ ( self , QModelIndex   other )