FilterSorter QML Type

Sorts rows based on if they match filters. More...

Import Statement: import SortFilterProxyModel .
Inherits:

Sorter

Properties

Detailed Description

A FilterSorter is a Sorter that orders row matching its filters before the rows not matching the filters.

In the following example, rows with their favorite role set to true will be ordered at the beginning :

SortFilterProxyModel {
    sourceModel: contactModel
    sorters: FilterSorter {
        ValueFilter { roleName: "favorite"; value: true }
    }
}

See also FilterContainer.

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.


[default] filters : list<Filter>

This property holds the list of filters for this filter sorter. If a row match all this FilterSorter's filters, it will be ordered before rows not matching all the filters.

See also Filter and FilterContainer.


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.


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.