Sorts rows by comparing a source model string role with a localized collation algorithm. More...
Import Statement: | import Felgo 4.0 |
Since: | Felgo 2.18.1 |
Inherits: |
StringSorter is a specialized RoleSorter that sorts rows based on a source model string role. StringSorter compares strings according to a localized collation algorithm using QCollator.
In the following example, rows with be sorted by their lastName
role :
SortFilterProxyModel {
sourceModel: contactModel
sorters: StringSorter { roleName: "lastName" }
}
Note: Comparing string values with QCollator may produce different behavior depending on the target platform. This results in limited sorted capabililties on mobile platforms. Use the LocaleAwareSorter for a natural and consistent string sorting across platforms.
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.
ignorePunctation : bool |
This property holds whether the sorter ignores punctation. if ignorePunctuation
is true
, punctuation characters and symbols are ignored when determining sort order.
Note: This property is not currently supported on Apple platforms or if Qt is configured to not use ICU on Linux.
locale : Locale |
This property holds the locale of the sorter.
numericMode : bool |
This property holds whether the numeric mode of the sorter is enabled. This will enable proper sorting of numeric digits, so that e.g. 100 sorts after 99. By default this mode is off.
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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: