FunctionFilter QML Type
SortFilterProxyModel 의 데이터를 지정된 'filter' 메서드의 평가 결과에 따라 필터링합니다. 더 보기...
| Import Statement: | import QtQml.Models |
| Since: | Qt 6.10 |
| Inherits: | |
| Status: | Technology preview |
이 유형은 기술 미리보기 단계에 있으며 변경될 수 있습니다.
상세 설명
FunctionFilter를 사용하면 사용자가 지정된 'filter' 메서드를 정의할 수 있으며, 이 메서드가 평가되어 데이터가 필터링됩니다. 'filter' 메서드는 하나의 인자를 받으며, 아래와 같이 인라인 컴포넌트로 정의할 수 있습니다:
SortFilterProxyModel {
sourceModel: model
filters: [
FunctionFilter {
id: functionFilter
property int ageLimit: 20
function filter(age: int) : bool {
return (age <= ageLimit)
}
}
]
}참고: 지정된 'filter' 메서드 내에서 사용되는 외부 QML 속성이 변경될 때마다사용자는 SortFilterProxyModel::invalidate 를 명시적으로 호출해야 합니다. 이러한 동작은 향후 암시적 무효화(implicit invalidation)와 같이 변경될 수 있으므로, 사용자는 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.