AnyOfFilter QML Type

Combines multiple filters using logical OR 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

AnyOfFilter groups a set of child filters and finds a matching row or column for least one of child filter in the group. This is useful when you have many independent conditions to include a row, without requiring all conditions to be satisfied.

The following snippet shows how AnyOfFilter can be used to include rows where status is either "active" or "pending":

 SortFilterProxyModel {
     sourceModel: model
     filters: [
         AnyOfFilter {
             ValueFilter {
                 roleName: "status"
                 value: "active"
             }
             ValueFilter {
                 roleName: "status"
                 value: "pending"
             }
         }
     ]
 }

Property Documentation

filters : list<Filter>

The list of child filters evaluated with logical OR. A row is accepted if at least one filter in this list accepts it.

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

 AnyOfFilter {
     ValueFilter { roleName: "status"; value: "active" }
     ValueFilter { roleName: "status"; value: "pending" }
 }