FunctionFilter QML Type
Filtra i dati in un’istanza di SortFilterProxyModel in base alla valutazione del metodo “filter” specificato. Altro...
| Import Statement: | import QtQml.Models |
| Since: | Qt 6.10 |
| Inherits: | |
| Status: | Technology preview |
Questo tipo è in anteprima tecnologica ed è soggetto a modifiche.
Descrizione dettagliata
FunctionFilter consente all’utente di definire il metodo “filter” specificato, che verrà valutato per filtrare i dati. Il metodo “filter” accetta un argomento e può essere definito come componente inline come illustrato di seguito:
SortFilterProxyModel {
sourceModel: model
filters: [
FunctionFilter {
id: functionFilter
property int ageLimit: 20
function filter(age: int) : bool {
return (age <= ageLimit)
}
}
]
}Nota: l’utente deve richiamare esplicitamente ` SortFilterProxyModel::invalidate ` ogni volta che una proprietà QML esterna utilizzata all’interno del metodo “filter” specificato subisce una modifica. Questo comportamento è soggetto a modifiche in futuro, come l’invalidazione implicita, per cui l’utente non dovrà più richiamare esplicitamente ` SortFilterProxyModel::invalidate`.
© 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.