StringSorter QML Type | Qt 6.12
Description: Sort data in a SortFilterProxyModel based on ordering of the locale.
Keywords: qmltype

- Qt 6.12
- QML Types
- StringSorter
- Qt 6.12.0 Reference Documentation

# StringSorter QML Type

Sort data in a SortFilterProxyModel based on ordering of the locale. More...

Import Statement: | `import QtQml.Models`
Since: | Qt 6.10
Inherits: | Sorter
Status: | Technology preview

This type is in technology preview and is subject to change.

- List of all members, including inherited members

## Properties

- caseSensitivity : Qt::CaseSensitivity
- ignorePunctuation : bool
- locale : Locale
- numericMode : bool

## Detailed Description

StringSorter allows the user to sort the data according to the role name as configured in the source model. StringSorter compares strings according to a localized collation algorithm.

The StringSorter can be configured in the sort filter proxy model as below,

     SortFilterProxyModel {
         sourceModel: model
         sorters: [
             StringSorter { roleName: "name" }
         ]
     }

## Property Documentation

### caseSensitivity : Qt::CaseSensitivity

This property holds the case sensitivity of the sorter.

The default value is Qt::CaseSensitive.

### ignorePunctuation : bool

This property holds whether the sorter ignores punctation. If `ignorePunctuation` is `true`, punctuation characters and symbols are ignored when determining sort order.

The default value is `false`.

### locale : Locale

This property holds the locale of the sorter.

The default value is QLocale::system()

### numericMode : bool

This property holds whether the numeric mode of the sorter is enabled.

The default value is `false`.