Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


Sorts rows based on a locale aware comparison of a source model string role. More...

Import Statement: import Felgo 3.0
Since: Felgo 3.9.1



Detailed Description

LocaleAwareSorter is a specialized RoleSorter that sorts rows based on a source model string role. LocaleAwareSorter sorts values by a doing a localized string comparison using QString::localeAwareCompare().

In the following example, rows will be sorted by their lastName role:

 SortFilterProxyModel {
    sourceModel: contactModel
    sorters: LocaleAwareSorter { roleName: "lastName" }

Note: For desktop platforms you can alternatively use the StringSorter, which offers additional features like the StringSorter::numericMode. However, for consistent sorting behavior across different target platforms the LocaleAwareSorter is recommended.

Property Documentation

caseSensitivity : Qt.CaseSensitivity

This property holds the case sensitivity of the sorter.

enabled : bool

This property holds whether the sorter is enabled. A disabled sorter will not change the order of the rows.

By default, sorters are enabled.

ignoreDiacritics : bool

If active, diacritical marks are ignored, which makes the sorter insensitive to accent characters. For example, letters like Ä and ê are sorted among their un-accented variants A and e then.

sortOrder : Qt::SortOrder

This property holds the sort order of this sorter.

Constant Description
Qt.AscendingOrder The items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrder The items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales

By default, sorting is in ascending order.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded