KSortFilterProxyModel QML Type

Filter and sort an existing QAbstractItemModel. More...

Import Statement: import org.kde.kitemmodels
Since: 5.67

Properties

Methods

Detailed Description

Property Documentation

count : int

The number of top level rows.


filterColumnCallback : var

A JavaScript callable that can be used to perform advanced filters on a given column. The callback is passed the source column, and source parent for a given column as arguments.

@see filterRowCallback


filterRoleName : string

The role of the sourceModel on which the filter will be applied. This can either be the numerical role value or the role name as a string.


filterRowCallback : var

A JavaScript callable that can be used to perform advanced filters on a given row. The callback is passed the source row, and source parent for a given row as arguments

The callable's return value is evaluated as boolean to determine whether the row is accepted (true) or filtered out (false). It overrides the default implementation that uses filterRegExp or filterString; while filterCallback is set those two properties are ignored. Attempts to write a non-callable to this property are silently ignored, but you can set it to null.

filterRowCallback: function(source_row, source_parent) {
  return sourceModel.data(sourceModel.index(source_row, 0, source_parent), Qt.DisplayRole) == "...";
};

filterString : string

The string for the filter, only rows with their filterRole matching filterString will be displayed


sortColumn : int

Specify which column should be used for sorting The default value is -1. If sortRole is set, the default value is 0.


sortOrder : Qt::SortOrder

One of Qt.AscendingOrder or Qt.DescendingOrder


sortRoleName : string

The role of the sourceModel that will be used for sorting. if empty the order will be left unaltered This can either be the numerical role value or the role name as a string.


Method Documentation

[since 5.70] invalidateFilter()

Invalidates the current filtering.

This function should be called if you are implementing custom filtering through filterRowCallback or filterColumnCallback, and your filter parameters have changed.

This method was introduced in 5.70.