本页内容

Qt Qml 模型

此 QML 模块包含用于在 QML 中定义数据模型的类型。

要使用本模块中的类型,请使用以下代码行导入该模块:

import QtQml.Models

注意: QtQml.Models 模块从 2.1 版本开始,其版本号与父模块保持一致, Qt Qml。

此外,Qt.labs.qmlmodels 提供了用于模型的实验性 Qml 类型。要使用这些实验性类型,请使用以下代码行导入该模块:

import Qt.labs.qmlmodels

QML 类型

AllOfFilter

在 SortFilterProxyModel 中使用逻辑与(AND)组合多个过滤器

AnyOfFilter

在 SortFilterProxyModel 中使用逻辑“或”运算组合多个过滤器

DelegateChoice

封装委托及其使用场景

DelegateChooser

允许视图针对模型中不同类型的项目使用不同的委托

DelegateModel

封装模型和委托

DelegateModelGroup

封装一组经过筛选的可视化数据项

FilterBase

提供过滤器通用功能的抽象基类

FunctionFilter

根据对指定“filter”方法的评估,对 SortFilterProxyModel 中的数据进行过滤

Instantiator

动态创建对象

ItemSelectionModel

实例化一个 QItemSelectionModel,用于与 QAbstractItemModel 以及支持该模型的任何视图配合使用

ListElement

在 ListModel 中定义数据项

ListModel

定义自由格式列表数据源

ObjectModel

定义一组用作模型的项目

Package

指定一组命名项

RangeFilter

通过测试角色值是否落在给定范围内,对 SortFilterProxyModel 中的数据进行过滤

RegExpFilter

通过将角色值与正则表达式进行匹配,对 SortFilterProxyModel 中的数据进行过滤

RoleFilter

提供角色相关过滤功能的抽象基类

RoleSorter

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

SortFilterProxyModel

为 QAbstractItemModel 提供排序和过滤功能

Sorter

提供排序器通用功能的抽象基类

StringSorter

根据区域设置的排序规则对 SortFilterProxyModel 中的数据进行排序

ValueFilter

根据角色名称和值对 SortFilterProxyModel 中的数据进行过滤

实验性 QML 类型

TableModel

封装了一个简单的表格模型

TableModelColumn

表示模型中的一个列

TreeModel

封装了一个简单的树模型

许可

Qt Qml Models 可通过The Qt Company 提供的商业许可证使用。此外,它还遵循GNU 较宽松通用公共许可证第 3 版或 GNU 通用公共许可证第 2 版。更多详细信息请参阅Qt 许可条款。

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