ExpressionFilter QML Type | SortFilterProxyModel

# ExpressionFilter QML Type

Filters row with a custom filtering. More...

Import Statement: | import SortFilterProxyModel .
Inherits: | Filter

- List of all members, including inherited members

## Properties

- enabled : bool
- expression : expression
- inverted : bool

## Detailed Description

An ExpressionFilter is a Filter allowing to implement custom filtering based on a javascript expression.

## Property Documentation

enabled : bool

This property holds whether the filter is enabled. A disabled filter will accept every rows unconditionally (even if it's inverted).

By default, filters are enabled.

expression : expression

An expression to implement custom filtering, it must evaluate to a boolean. It has the same syntax has a Property Binding except it will be evaluated for each of the source model's rows. Rows that have their expression evaluating to `true` will be accepted by the model. Data for each row is exposed like for a delegate of a QML View.

This expression is reevaluated for a row every time its model data changes. When an external property (not `index` or in `model`) the expression depends on changes, the expression is reevaluated for every row of the source model. To capture the properties the expression depends on, the expression is first executed with invalid data and each property access is detected by the QML engine. This means that if a property is not accessed because of a conditional, it won't be captured and the expression won't be reevaluted when this property changes.

A workaround to this problem is to access all the properties the expressions depends unconditionally at the beggining of the expression.

inverted : bool

This property holds whether the filter is inverted. When a filter is inverted, a row normally accepted would be rejected, and vice-versa.

By default, filters are not inverted.