PySide6.QtCore.QCollatorSortKey

class QCollatorSortKey

QCollatorSortKey 类可用于加速字符串排序。更多

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

QCollatorSortKey 类总是由 sortKey() 创建,并用于快速字符串排序,例如在对多个字符串进行排序时。

__init__(other)
Parameters:

其他QCollatorSortKey

构造一个other排序键的副本。

compare(key)
Parameters:

keyQCollatorSortKey

Return type:

整数

将此键与otherKey进行比较,该键必须由同一个QCollator的sortKey()创建。比较是根据该QCollator的排序顺序进行的。

如果此键排序在otherKey之前,则返回负值;如果两个键相等,则返回0;如果此键排序在otherKey之后,则返回正值。

另请参阅

operator

__lt__(rhs)
Parameters:

rhsQCollatorSortKey

Return type:

布尔

两个键必须由同一个QCollator的sortKey()创建。如果根据创建它们的QCollatorlhs应该在rhs之前排序,则返回true;否则返回false

另请参阅

compare()

swap(other)
Parameters:

其他QCollatorSortKey

将此排序器键与 other 交换。