PySide6.QtCore.QCollatorSortKey¶
- class QCollatorSortKey¶
QCollatorSortKey
类可用于加速字符串排序。更多…概要¶
方法¶
def
__init__()
def
compare()
def
__lt__()
def
swap()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
QCollatorSortKey
类总是由sortKey()
创建,并用于快速字符串排序,例如在对多个字符串进行排序时。- __init__(other)¶
- Parameters:
其他 –
QCollatorSortKey
构造一个
other
排序键的副本。- compare(key)¶
- Parameters:
key –
QCollatorSortKey
- Return type:
整数
将此键与
otherKey
进行比较,该键必须由同一个QCollator
的sortKey()创建。比较是根据该QCollator
的排序顺序进行的。如果此键排序在
otherKey
之前,则返回负值;如果两个键相等,则返回0;如果此键排序在otherKey
之后,则返回正值。另请参阅
operator
- __lt__(rhs)¶
- Parameters:
rhs –
QCollatorSortKey
- Return type:
布尔
两个键必须由同一个
QCollator
的sortKey()创建。如果根据创建它们的QCollator
,lhs
应该在rhs
之前排序,则返回true
;否则返回false
。另请参阅
- swap(other)¶
- Parameters:
其他 –
QCollatorSortKey
将此排序器键与
other
交换。