QCollator Class

The QCollator class compares strings according to a localized collation algorithm. More...

Header: #include <QCollator>
qmake: QT += core
Since: Qt 5.2

This class was introduced in Qt 5.2.

Note: All functions in this class are reentrant.

Detailed Description

QCollator is initialized with a QLocale and an optional collation strategy. It tries to initialize the collator with the specified values. The collator can then be used to compare and sort strings in a locale dependent fashion.

A QCollator object can be used together with template based sorting algorithms such as std::sort to sort a list of QStrings.

In addition to the locale and collation strategy, several optional flags can be set that influence the result of the collation.