ValueFilter QML Type
根据角色名称和值过滤SortFilterProxyModel 中的数据。更多内容...
| Import Statement: | import QtQml.Models |
| Since: | Qt 6.10 |
| Inherits: | |
| Status: | Technology preview |
此类型处于技术预览阶段,可能会有变动。
属性
- value : variant
详细说明
ValueFilter 允许用户根据源模型中配置的角色名称、指定值或两者兼而有之来过滤数据。用于过滤数据的角色名称应基于模型role name 。角色名称的默认值为"display" 。
以下代码片段演示了如何使用 ValueFilter,仅包含源模型中角色名称"favorite" 的值为"true" 的数据:
SortFilterProxyModel {
sourceModel: model
filters: [
ValueFilter {
roleName: "favorite"
value: true
}
]
}属性文档
value : variant
该属性存储了可用于过滤数据的特定值。
© 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.