このページでは

FunctionFilter QML Type

SortFilterProxyModel 内のデータを、指定された「filter」メソッドの評価に基づいてフィルタリングします。詳細...

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

FilterBase

Status: Technology preview

このタイプはテクノロジープレビュー版であり、変更される可能性があります。

詳細な説明

FunctionFilter を使用すると、指定された「filter」メソッドを定義でき、その評価結果に基づいてデータがフィルタリングされます。「filter」メソッドは 1 つの引数を取り、以下のようにインラインコンポーネントとして定義できます:

SortFilterProxyModel {
    sourceModel: model
    filters: [
        FunctionFilter {
            id: functionFilter
            property int ageLimit: 20
            function filter(age: int) : bool {
                return (age <= ageLimit)
            }
        }
    ]
}

注: 指定された「filter」メソッド内で使用されている外部QMLプロパティが変更された場合は、ユーザーが 明示的にSortFilterProxyModel::invalidate を呼び出す必要があります 。この動作は将来、暗黙的な無効化などにより変更される可能性があり、その場合はユーザーが明示的に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.