ItemModelBarDataProxy QML Type
Import Statement: | import QtGraphs |
In C++: | QItemModelBarDataProxy |
Inherits: |
- 所有成员(包括继承成员)的列表
- ItemModelBarDataProxy 是Qt Graphs QML Types for 3D 的一部分。
属性
- autoColumnCategories : bool
- autoRowCategories : bool
- columnCategories : list<String>
- columnRole : string
- columnRolePattern : regExp
- columnRoleReplace : string
- itemModel : model
- multiMatchBehavior : enumeration
- rotationRole : string
- rotationRolePattern : regExp
- rotationRoleReplace : string
- rowCategories : list<String>
- rowRole : string
- rowRolePattern : regExp
- rowRoleReplace : string
- type : AbstractDataProxy.DataType
- useModelCategories : bool
- valueRole : string
- valueRolePattern : regExp
- valueRoleReplace : string
信号
- autoColumnCategoriesChanged(bool enable)
- autoRowCategoriesChanged(bool enable)
- columnCategoriesChanged()
- columnRoleChanged(string role)
- columnRolePatternChanged(regExp pattern)
- columnRoleReplaceChanged(string replace)
- itemModelChanged(model itemModel)
- multiMatchBehaviorChanged(enumeration behavior)
- rotationRoleChanged(string role)
- rotationRolePatternChanged(regExp pattern)
- rotationRoleReplaceChanged(string replace)
- rowCategoriesChanged()
- rowRoleChanged(string role)
- rowRolePatternChanged(regExp pattern)
- rowRoleReplaceChanged(string replace)
- useModelCategoriesChanged(bool enable)
- valueRoleChanged(string role)
- valueRolePatternChanged(regExp pattern)
- valueRoleReplaceChanged(string replace)
详细描述
该类型允许您使用 AbstractItemModel 派生模型作为Bars3D 的数据源。
只要映射或模型发生变化,数据就会异步解析。QBarDataProxy::arrayReset(当数据已解析时,将发出()。
有关 ItemModelBarDataProxy 枚举,请参见QItemModelBarDataProxy::MultiMatchBehavior 。
更多详情,请参阅QItemModelBarDataProxy 文档。
使用示例:
ItemModelBarDataProxy { itemModel: model // E.g. a list model defined elsewhere containing yearly expenses data. // Mapping model roles to bar series rows, columns, and values. rowRole: "year" columnRole: "city" valueRole: "expenses" rowCategories: ["2020", "2021", "2022", "2023"] columnCategories: ["Oulu", "Rauma", "Helsinki", "Tampere"] }
另请参阅 BarDataProxy 和Qt Graphs 3D 数据处理。
属性文档
autoColumnCategories : bool |
当设置为true
时,映射会忽略任何显式设置的列类别,并在解析来自模型的数据时用自动生成的类别覆盖它们。默认为true
。
autoRowCategories : bool |
当设置为true
时,映射会忽略任何显式设置的行类别,并在解析模型数据时用自动生成的类别覆盖它们。默认为true
。
columnCategories : list<String> |
映射的列类别。在解析数据时,只有列角色值在此列表中的项目才会被包括在内。列的顺序与此列表中的顺序相同。
columnRole : string |
要映射到列类别中的项目模型角色。
columnRolePattern : regExp |
如果设置了该属性,则会在将列角色映射的值用作列类别之前对其进行搜索和替换。该属性指定正则表达式,用于查找要替换的映射值部分,而columnRoleReplace 属性则包含替换字符串。例如,在从条目模型中的单个时间戳字段解析行和列类别时,这就非常有用。
另请参阅 columnRole 和columnRoleReplace 。
columnRoleReplace : string |
该属性定义了与columnRolePattern 结合使用的替换内容。默认为空字符串。有关使用正则表达式进行搜索和替换的工作原理,请参阅QString::replace(constQRegularExpression &rx, constQString &after) 函数文档。
另请参阅 columnRole 和columnRolePattern 。
itemModel : model |
项目模型。
multiMatchBehavior : enumeration |
定义如何处理每行/列组合的多个匹配项。默认值为ItemModelBarDataProxy.MultiMatchBehavior.Last 。选择的行为会影响条形图的值和旋转。
例如,您可能有一个带有时间戳数据的项目模型,这些数据以不规则的时间间隔采集,您希望用条形图显示每天数据项的总价值。为此,您可以指定行和列的类别,使每个条形图代表一天,并将 multiMatchBehavior 设置为ItemModelBarDataProxy.MultiMatchBehavior.Cumulative 。
rotationRole : string |
项目模型角色映射到条形图旋转角度。
rotationRolePattern : regExp |
设置后,将对旋转角色映射的值进行搜索和替换,然后再将其用作条形图旋转角度。该属性指定正则表达式,用于查找要替换的映射值部分,rotationRoleReplace 属性包含替换字符串。
另请参阅 rotationRole 和rotationRoleReplace 。
rotationRoleReplace : string |
该属性定义了与rotationRolePattern 一起使用的替换内容。默认为空字符串。有关使用正则表达式进行搜索和替换的工作原理,请参阅QString::replace(constQRegularExpression &rx, constQString &after) 函数文档。
另请参阅 rotationRole 和rotationRolePattern 。
rowCategories : list<String> |
映射的行类别。在解析数据时,只有在此列表中找到行角色值的项目才会被包含在内。行的顺序与此列表中的顺序相同。
rowRole : string |
要映射到行类别中的项目模型角色。
rowRolePattern : regExp |
如果设置了该属性,则会在行角色映射的值用作行类别之前对其进行搜索和替换。该属性指定了正则表达式,用于查找要替换的映射值部分,而rowRoleReplace 属性则包含替换字符串。例如,这在从项目模型中的单个时间戳字段解析行和列类别时非常有用。
另请参阅 rowRole 和rowRoleReplace 。
rowRoleReplace : string |
该属性定义了与rowRolePattern 结合使用的替换内容。默认为空字符串。有关使用正则表达式进行搜索和替换的工作原理,请参阅QString::replace(constQRegularExpression &rx, constQString &after) 函数文档。
另请参阅 rowRole 和rowRolePattern 。
type : AbstractDataProxy.DataType |
代理类型。QAbstractDataProxy::DataType 值之一。
useModelCategories : bool |
当设置为true
时,映射会忽略行和列的角色和类别,而使用模型中的行和列。行和列标题用于行和列标签。默认为false
。
valueRole : string |
要映射到条形图值的项目模型角色。
valueRolePattern : regExp |
设置后,将对值角色映射的值进行搜索和替换,然后再将其用作条形图值。该属性指定正则表达式,用于查找要替换的映射值部分,valueRoleReplace 属性包含替换字符串。
另请参阅 valueRole 和valueRoleReplace 。
valueRoleReplace : string |
该属性定义了与valueRolePattern 一起使用的替换内容。默认为空字符串。有关使用正则表达式进行搜索和替换的工作原理,请参阅QString::replace(constQRegularExpression &rx, constQString &after) 函数文档。
另请参阅 valueRole 和valueRolePattern 。
信号文档
autoColumnCategoriesChanged(bool enable) |
当autoColumnCategories 更改为enable 时,将发出该信号。
注: 相应的处理程序是onAutoColumnCategoriesChanged
。
autoRowCategoriesChanged(bool enable) |
当autoRowCategories 变更为enable 时,发出此信号。
注: 相应的处理程序是onAutoRowCategoriesChanged
。
columnCategoriesChanged() |
当columnCategories 变更时,发出此信号。
注: 相应的处理程序是onColumnCategoriesChanged
。
columnRoleChanged(string role) |
当columnRole 变更为role 时会发出该信号。
注: 相应的处理程序是onColumnRoleChanged
。
columnRolePatternChanged(regExp pattern) |
当columnRolePattern 变更为pattern 时,发出此信号。
注: 相应的处理程序是onColumnRolePatternChanged
。
columnRoleReplaceChanged(string replace) |
当columnRoleReplace 变更为replace 时,发出此信号。
注: 相应的处理程序是onColumnRoleReplaceChanged
。
itemModelChanged(model itemModel) |
当itemModel 变更为itemModel 时,发出此信号。
注: 相应的处理程序是onItemModelChanged
。
multiMatchBehaviorChanged(enumeration behavior) |
当multiMatchBehavior 变更为behavior 时,发出此信号。
注: 相应的处理程序是onMultiMatchBehaviorChanged
。
rotationRoleChanged(string role) |
当rotationRole 变更为role 时,发出此信号。
注: 相应的处理程序是onRotationRoleChanged
。
rotationRolePatternChanged(regExp pattern) |
当rotationRolePattern 变更为pattern 时,发出此信号。
注: 相应的处理程序是onRotationRolePatternChanged
。
rotationRoleReplaceChanged(string replace) |
当rotationRoleReplace 变更为replace 时,发出此信号。
注: 相应的处理程序是onRotationRoleReplaceChanged
。
rowCategoriesChanged() |
当rowCategories 变更时发出此信号。
注: 相应的处理程序是onRowCategoriesChanged
。
rowRolePatternChanged(regExp pattern) |
当rowRolePattern 变更为pattern 时,发出此信号。
注: 相应的处理程序是onRowRolePatternChanged
。
rowRoleReplaceChanged(string replace) |
当rowRoleReplace 变更为replace 时,发出此信号。
注: 相应的处理程序是onRowRoleReplaceChanged
。
useModelCategoriesChanged(bool enable) |
当useModelCategories 变更为enable 时,发出该信号。
注: 相应的处理程序是onUseModelCategoriesChanged
。
valueRolePatternChanged(regExp pattern) |
当valueRolePattern 变更为pattern 时会发出该信号。
注: 相应的处理程序是onValueRolePatternChanged
。
valueRoleReplaceChanged(string replace) |
当valueRoleReplace 变更为replace 时,发出该信号。
注: 相应的处理程序是onValueRoleReplaceChanged
。
© 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.