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

LocaleAwareSorter

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
Inherits:

RoleSorter

Properties

Detailed Description

LocaleAwareSorter is a specialized RoleSorter that sorts rows based on a source model string role. LocaleAwareSorter sorts values in a natural way and can also handle alphanumeric strings that contain numbers.

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

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

Note: On desktop platforms you can alternatively use the StringSorter, which can slightly improve performance. 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. Sorting is case-sensitive by default.


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. This setting is disabled by default.


locale : Locale

This property holds the locale of the sorter.


naturalSort : bool

This property is enabled by default. If active, strings are sorted in a natural way to e.g. show a lowercase a before an uppercase Z. While maintaining this overall order, the sorting is still sensitive to accent characters and casing of the letters.


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