En esta página

QCollatorSortKey Class

La clase `QCollatorSortKey` se puede utilizar para acelerar la ordenación de cadenas. Más información...

Encabezado: #include <QCollatorSortKey>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

Nota: Todas las funciones de esta clase son reentrantes.

Comparaciones de QCollatorSortKey

CategoríaTipos comparables
débilQCollatorSortKey

Funciones públicas

QCollatorSortKey()
QCollatorSortKey(const QCollatorSortKey &other)
(since 6.8) QCollatorSortKey(QCollatorSortKey &&other)
~QCollatorSortKey()
int compare(const QCollatorSortKey &otherKey) const
void swap(QCollatorSortKey &other)
QCollatorSortKey &operator=(QCollatorSortKey &&other)
QCollatorSortKey &operator=(const QCollatorSortKey &other)
(since 6.12) bool operator!=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
(since 6.12) bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
(since 6.12) bool operator<=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
(since 6.12) bool operator==(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
(since 6.12) bool operator>(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
(since 6.12) bool operator>=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

Descripción detallada

La clase QCollatorSortKey siempre se crea mediante QCollator::sortKey() y se utiliza para la colación rápida de cadenas, por ejemplo, al colar muchas cadenas.

Véase también QCollator, QCollator::sortKey() y compare().

Documentación de las funciones miembro

[delete] QCollatorSortKey::QCollatorSortKey()

Crea por defecto una instancia de ` QCollatorSortKey`. Esta función se ha eliminado.

QCollatorSortKey::QCollatorSortKey(const QCollatorSortKey &other)

Crea una copia de la clave del clasificador « other ».

[constexpr noexcept default, since 6.8] QCollatorSortKey::QCollatorSortKey(QCollatorSortKey &&other)

Crea y asigna un nuevo objeto `QCollatorSortKey` a partir de ` other`.

Nota: El objeto del que se ha realizado el movimiento, ` other `, queda en un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.

Esta función se introdujo en Qt 6.8.

[noexcept] QCollatorSortKey::~QCollatorSortKey()

Elimina la clave del clasificador.

[noexcept] int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const

Compara esta clave con otherKey, que debe haber sido creada por el mismo método sortKey() de QCollator que esta clave. La comparación se realiza de acuerdo con el orden de clasificación de QCollator.

Devuelve un valor negativo si esta clave se ordena antes que otherKey, 0 si ambas claves son iguales, o un valor positivo si esta clave se ordena después de otherKey.

Véase también operator==(), operator!=(), operator<(), operator<=(), operator>() y operator>=().

[noexcept] void QCollatorSortKey::swap(QCollatorSortKey &other)

Intercambia esta clave de ordenación por other. Esta operación es muy rápida y nunca falla.

[noexcept] QCollatorSortKey &QCollatorSortKey::operator=(QCollatorSortKey &&other)

La operación «move-assign» asigna other a esta instancia de QCollatorSortKey.

Nota: El objeto del que se ha realizado el traslado, other, pasa a un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.

QCollatorSortKey &QCollatorSortKey::operator=(const QCollatorSortKey &other)

Asigna « other » a esta clave de ordenación.

Elementos no miembros relacionados

[noexcept, since 6.12] bool operator!=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

[noexcept, since 6.12] bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

[noexcept, since 6.12] bool operator<=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

[noexcept, since 6.12] bool operator==(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

[noexcept, since 6.12] bool operator>(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

[noexcept, since 6.12] bool operator>=(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)

Ambas claves deben haber sido creadas por la misma función `sortKey()` de ` QCollator`. Compara ` lhs ` y ` rhs ` según el ` QCollator ` que las creó.

Estas funciones se introdujeron en Qt 6.12.

Véase también QCollatorSortKey::compare().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.