RoleSorter QML Type

根据配置的角色名称对SortFilterProxyModel 中的数据进行排序。更多

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

Sorter

Status: Preliminary

此类型正在开发中,可能会有更改。

属性

详细说明

RoleSorter 允许用户根据源模型中配置的角色名称对数据进行排序。

RoleSorter 可在排序筛选器代理模型中配置,如下所示、

SortFilterProxyModel {
    model: sourceModel
    sorters: [
        RoleSorter { roleName: "firstname" }
    ]
}

属性文档

roleName : string

该属性包含用于排序数据的角色名称。

默认值为显示角色。


© 2025 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.