QPieModelMapper Class
QPieModelMapper 是一个用于饼图系列的模型映射器。更多内容...
| 标题: | #include <QPieModelMapper> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| 在 QML 中: | PieModelMapper |
| 继承自: | QObject |
- 所有成员列表(包括继承的成员)
- QPieModelMapper 属于Qt Graphs 的2D C++ 类。
属性
|
|
公共函数
| qsizetype | count() const |
| qsizetype | first() const |
| qsizetype | labelsSection() const |
| QAbstractItemModel * | model() const |
| Qt::Orientation | orientation() const |
| QPieSeries * | series() const |
| void | setCount(qsizetype count) |
| void | setFirst(qsizetype first) |
| void | setLabelsSection(qsizetype labelsSection) |
| void | setModel(QAbstractItemModel *model) |
| void | setOrientation(Qt::Orientation orientation) |
| void | setSeries(QPieSeries *series) |
| void | setValuesSection(qsizetype valuesSection) |
| qsizetype | valuesSection() const |
信号
| void | countChanged() |
| void | firstChanged() |
| void | labelsSectionChanged() |
| void | modelChanged() |
| void | orientationChanged() |
| void | seriesChanged() |
| void | valuesSectionChanged() |
受保护函数
| QPieModelMapper(const QPieModelMapper &) | |
| QPieModelMapper(QPieModelMapper &&) | |
| QPieModelMapper & | operator=(QPieModelMapper &&) |
| QPieModelMapper & | operator=(const QPieModelMapper &) |
详细说明
模型映射器允许将源自QAbstractItemModel 类的数据模型用作图的数据源。模型映射器用于在数据模型与QPieSeries 之间建立连接。
既可以使用模型属性,也可以使用扇形图系列属性来操作数据。模型映射器会保持扇形图系列与数据模型之间的同步。
属性文档
count : qsizetype
该属性存储模型中映射为饼图系列数据行的列数或行数。
其最小值和默认值为 -1(具体数值受模型中行数的限制)。
访问函数:
| qsizetype | count() const |
| void | setCount(qsizetype count) |
通知信号:
| void | countChanged() |
另请参阅 QPieModelMapper::orientation 。
first : qsizetype
该属性存储了模型中包含第一个切片值的列或行。
其最小值和默认值均为 0。
访问函数:
| qsizetype | first() const |
| void | setFirst(qsizetype first) |
通知信号:
| void | firstChanged() |
另请参阅 QPieModelMapper::orientation 。
labelsSection : qsizetype
该属性存储模型中与饼图扇区标签保持同步的列或行。
默认值为 -1(映射无效)。
访问函数:
| qsizetype | labelsSection() const |
| void | setLabelsSection(qsizetype labelsSection) |
通知器信号:
| void | labelsSectionChanged() |
另请参阅 QPieModelMapper::orientation 。
model : QAbstractItemModel*
该属性存储映射器所使用的模型。
访问函数:
| QAbstractItemModel * | model() const |
| void | setModel(QAbstractItemModel *model) |
通知器信号:
| void | modelChanged() |
orientation : Qt::Orientation
告知 ModelMapper 如何将数据映射到模型。 如果使用Qt::Vertical ,模型的每一行定义一个扇区,模型的每一列定义该扇区的标签或数值。当方向设置为Qt::Horizontal 时,模型的每一列定义一个扇区,模型的每一行定义该扇区的标签或数值。
默认值为Qt::Vertical
访问函数:
| Qt::Orientation | orientation() const |
| void | setOrientation(Qt::Orientation orientation) |
通知信号:
| void | orientationChanged() |
series : QPieSeries*
该属性存储映射器所使用的饼图系列。
当该系列被设置为映射器时,其中的所有数据都会被丢弃。当指定新的系列时,旧系列将被断开连接(但会保留其数据)。
访问函数:
| QPieSeries * | series() const |
| void | setSeries(QPieSeries *series) |
通知器信号:
| void | seriesChanged() |
valuesSection : qsizetype
该属性用于指定模型中与饼图扇区值保持同步的列或行。
默认值为 -1(映射无效)。
访问函数:
| qsizetype | valuesSection() const |
| void | setValuesSection(qsizetype valuesSection) |
通知器信号:
| void | valuesSectionChanged() |
另请参阅 QPieModelMapper::orientation 。
成员函数文档
[protected delete] QPieModelMapper::QPieModelMapper(const QPieModelMapper &)
复制并构造一个QPieModelMapper 实例。该函数已被删除。
[protected delete] QPieModelMapper::QPieModelMapper(QPieModelMapper &&)
通过“move”操作构造一个QPieModelMapper 的实例。该函数已被删除。
[protected delete] QPieModelMapper &QPieModelMapper::operator=(QPieModelMapper &&)
将other 按“移动-赋值”方式赋值给此QPieModelMapper 实例。该函数已被删除。
[protected delete] QPieModelMapper &QPieModelMapper::operator=(const QPieModelMapper &)
将other 复制并赋值给该QPieModelMapper 实例。此函数已被删除。
© 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.