In questa pagina

ValueFilter QML Type

Filtra i dati in un SortFilterProxyModel in base al nome e al valore del ruolo. Altro...

Import Statement: import QtQml.Models
Since: Qt 6.10
Inherits:

RoleFilter

Status: Technology preview

Questo tipo è in anteprima tecnologica ed è soggetto a modifiche.

Proprietà

Descrizione dettagliata

ValueFilter consente all'utente di filtrare i dati in base al nome del ruolo, al valore specificato o a entrambi, come configurato nel modello di origine. Il nome del ruolo utilizzato per filtrare i dati deve basarsi sul modello role name. Il valore predefinito per il nome del ruolo è "display".

Il seguente frammento di codice mostra come ValueFilter possa essere utilizzato per includere solo i dati del modello di origine in cui il valore del nome del ruolo "favorite" è "true":

SortFilterProxyModel {
    sourceModel: model
    filters: [
        ValueFilter {
            roleName: "favorite"
            value: true
        }
    ]
}

Documentazione sulle proprietà

value : variant

Questa proprietà contiene il valore specifico che può essere utilizzato per filtrare i dati.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.