本页内容

RegExpFilter QML Type

通过将角色值与正则表达式进行匹配,对SortFilterProxyModel 中的数据进行筛选。更多内容...

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

RoleFilter

Status: Technology preview

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

属性

详细说明

RegExpFilter 允许通过在指定角色上进行正则表达式匹配来过滤模型数据。

可以将 JavaScript 正则表达式字面量直接赋值给 `regExp`:

SortFilterProxyModel {
    sourceModel: processModel
    filters: RegExpFilter {
        roleName: "userId"
        regExp: /root/i
    }
}

属性文档

regExp : regexp

该属性存储用于过滤数据的正则表达式。可以直接为其赋值一个 JavaScript 正则表达式字面量。

当 regExp 的模式为空时,过滤器处于非活动状态,所有行都会被放行。

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