QPersistentModelIndexclass is used to locate data in a data model. 更多 …
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)
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.
注意
You cannot store a
QStandardItemModel‘sQPersistentModelIndexin one of the model’s items.
QPersistentModelIndex
¶
QPersistentModelIndex(index)
QPersistentModelIndex(other)
other
–
QPersistentModelIndex
index
–
QModelIndex
PySide2.QtCore.QPersistentModelIndex.
child
(
row
,
column
)
¶
row
–
int
column
–
int
注意
此函数被弃用。
使用
index()
代替。
Returns the child of the model index that is stored in the given
row
and
column
.
PySide2.QtCore.QPersistentModelIndex.
column
(
)
¶
int
Returns the column this persistent model index refers to.
PySide2.QtCore.QPersistentModelIndex.
data
(
[
role=Qt.DisplayRole
]
)
¶
role
–
int
object
返回数据为给定
role
for the item referred to by the index.
另请参阅
ItemDataRole
setData()
PySide2.QtCore.QPersistentModelIndex.
flags
(
)
¶
ItemFlags
Returns the flags for the item referred to by the index.
PySide2.QtCore.QPersistentModelIndex.
internalId
(
)
¶
quintptr
PySide2.QtCore.QPersistentModelIndex.
internalPointer
(
)
¶
void
PySide2.QtCore.QPersistentModelIndex.
isValid
(
)
¶
bool
返回
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
(
)
¶
Returns the model that the index belongs to.
PySide2.QtCore.QPersistentModelIndex.
__ne__
(
other
)
¶
other
–
QModelIndex
bool
PySide2.QtCore.QPersistentModelIndex.
__ne__
(
other
)
¶
other
–
QPersistentModelIndex
bool
PySide2.QtCore.QPersistentModelIndex.
__lt__
(
other
)
¶
other
–
QPersistentModelIndex
bool
PySide2.QtCore.QPersistentModelIndex.operator=(other)
other
–
QModelIndex
PySide2.QtCore.QPersistentModelIndex.
__eq__
(
other
)
¶
other
–
QModelIndex
bool
PySide2.QtCore.QPersistentModelIndex.
__eq__
(
other
)
¶
other
–
QPersistentModelIndex
bool
PySide2.QtCore.QPersistentModelIndex.
parent
(
)
¶
Returns the parent
QModelIndex
for this persistent index, or an invalid
QModelIndex
if it has no parent.
PySide2.QtCore.QPersistentModelIndex.
row
(
)
¶
int
Returns the row this persistent model index refers to.
PySide2.QtCore.QPersistentModelIndex.
sibling
(
row
,
column
)
¶
row
–
int
column
–
int
Returns the sibling at
row
and
column
or an invalid
QModelIndex
if there is no sibling at this position.
另请参阅
PySide2.QtCore.QPersistentModelIndex.
swap
(
other
)
¶
other
–
QPersistentModelIndex
Swaps this persistent modelindex with
other
。此函数非常快,且从不失败。