本页内容

RoleSorter QML Type

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

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

Sorter

Status: Technology preview

此功能目前处于技术预览阶段,可能会有变动。

属性

详细说明

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

可在排序过滤器代理模型中按如下方式配置 RoleSorter:

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

属性文档

roleName : string

该属性存储用于对数据进行排序的角色名称。

默认值为“显示角色”。

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