AllOfFilter QML Type

Combines multiple filters using logical AND in a SortFilterProxyModel. More...

Import Statement: import QtQml.Models
Since: Qt 6.12
Status: Technology preview

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

Properties

Detailed Description

AllOfFilter groups a set of child filters and finds a matching row or column only when all child filters accept it. It is equivalent to applying multiple filters directly to SortFilterProxyModel, but allows the group itself to be enabled, disabled, or inverted as a single unit.

The following snippet shows how AllOfFilter can be used to include only rows where status is "active" and favorite is true:

 SortFilterProxyModel {
     sourceModel: model
     filters: [
         AllOfFilter {
             ValueFilter {
                 roleName: "parent";
                 value: "root"
             }
             ValueFilter {
                 roleName: "status";
                 value: "active"
             }
         }
     ]
 }

Property Documentation

filters : list<Filter>

The list of child filters evaluated with logical AND. A row is accepted if all the filters in this list accepts it.

This is the default property, so filters can be declared as direct children without the filters keyword:

 AllOfFilter {
     ValueFilter { roleName: "status"; value: "active" }
     ValueFilter { roleName: "parent"; value: "root" }
 }