本页内容

StringSorter QML Type

根据区域设置的排序规则对SortFilterProxyModel 中的数据进行排序。更多信息...

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

Sorter

Status: Technology preview

此类型处于技术预览阶段,可能会有变动。

属性

详细说明

StringSorter 允许用户根据源模型中配置的角色名称对数据进行排序。StringSorter 会根据本地化的排序规则算法对字符串进行比较。

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

SortFilterProxyModel {
    sourceModel: model
    sorters: [
        StringSorter { roleName: "name" }
    ]
}

属性文档

caseSensitivity : Qt::CaseSensitivity

此属性用于设置排序器的区分大小写设置。

默认值为Qt::CaseSensitive 。

ignorePunctuation : bool

该属性用于控制排序器是否忽略标点符号。如果ignorePunctuation 的值为true ,则在确定排序顺序时将忽略标点符号和特殊字符。

默认值为false 。

locale : Locale

该属性存储排序器的区域设置。

默认值为QLocale::system()

numericMode : bool

该属性控制排序器的数值模式是否启用。

默认值为false 。

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