PieModelMapper QML Type
饼系列的模型映射器。更多
Import Statement: | import QtGraphs |
In C++: | QPieModelMapper |
- 所有成员(包括继承成员)的列表
- PieModelMapper 是Qt Graphs QML Types for 2D 的一部分。
属性
- count : qsizetype
- first : qsizetype
- labelsSection : qsizetype
- model : model
- orientation : orientation
- series : PieSeries
- valuesSection : qsizetype
信号
- countChanged()
- firstChanged()
- labelsSectionChanged()
- modelChanged()
- orientationChanged()
- seriesChanged()
- valuesSectionChanged()
详细说明
模型映射器可将源自QAbstractItemModel 类的数据模型用作图形的数据源。模型映射器用于在数据模型和PieSeries 之间创建连接。
模型和饼状序列属性都可用于操作数据。模型映射器使饼系列和数据模型保持同步。
下面的 QML 示例创建了一个有四个切片的饼系列(假设模型至少有五行)。每个切片从第 1 列获得一个标签,从第 2 列获得一个值。
PieModelMapper { series: pieSeries model: customModel labelsSection: 1 valuesSection: 2 firstRow: 1 rowCount: 4 orientation: Qt.Vertical }
属性文档
count : qsizetype |
映射为饼状序列数据的模型列或行的数目。默认值为-1(受模型行数限制)。
另请参阅 orientation 。
first : qsizetype |
模型中包含第一个切片值的列或行。默认值为 0。
另请参阅 orientation 。
labelsSection : qsizetype |
模型中与饼的切片标签保持同步的列或行。默认值为-1(无效映射)。
另请参阅 orientation 。
model : model |
映射器使用的基于QAbstractItemModel 的模型。您需要实现该模型并将其暴露给 QML。
注意: 模型必须支持添加和删除行或列以及修改单元格中的数据。
orientation : orientation |
告诉模型映射器如何从模型映射数据。如果使用Qt.Vertical
,模型的每一行定义一个饼片,模型的每一列定义饼片的标签或值。当方向设置为Qt.Horizontal
时,模型的每一列定义一个饼片,模型的每一行定义饼片的标签或值。
默认值为Qt.Vertical
series : PieSeries |
映射器使用的饼系列。如果将映射器元素定义为PieSeries 的子元素,请不要定义此属性。设置为映射器时,系列中的所有数据都将被丢弃。当指定新系列时,旧系列将被断开(但保留其数据)。
valuesSection : qsizetype |
与饼的切片值保持同步的模型列或行。默认值为-1(无效映射)。
另请参阅 orientation 。
信号文档
countChanged() |
该信号在计数发生变化时发出。
注: 相应的处理程序是onCountChanged
。
firstChanged() |
当第一个切片发生变化时,会发出该信号。
注: 相应的处理程序是onFirstChanged
。
labelsSectionChanged() |
标签部分发生变化时会发出该信号。
注: 相应的处理程序是onLabelsSectionChanged
。
modelChanged() |
当映射器所连接的模型发生变化时,会发出该信号。
注: 相应的处理程序是onModelChanged
。
orientationChanged() |
当方向发生变化时会发出该信号。
注: 相应的处理程序是onOrientationChanged
。
seriesChanged() |
当映射器所连接的系列发生变化时会发出该信号。
注: 相应的处理程序是onSeriesChanged
。
valuesSectionChanged() |
值部分发生变化时会发出该信号。
注: 相应的处理程序是onValuesSectionChanged
。
© 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.