RoleSorter QML Type

Sorts rows based on a source model role. More...

Import Statement: import SortFilterProxyModel .
Inherits:

Sorter

Inherited By:

StringSorter

Properties

Detailed Description

A RoleSorter is a simple Sorter that sorts rows based on a source model role.

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

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

Property Documentation

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.


priority : int

This property holds the sort priority of this sorter. Sorters with a higher priority are applied first. In case of equal priority, Sorters are ordered by their insertion order.

By default, the priority is 0.


roleName : string

This property holds the role name that the sorter is using to query the source model's data when sorting items.


sortOrder : Qt::SortOrder

This property holds the sort order of this sorter.

ConstantDescription
Qt.AscendingOrderThe items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales
Qt.DescendingOrderThe items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales

By default, sorting is in ascending order.