QPieModelMapper Class

QPieModelMapper 是派系列的模型映射器。更多

Header: #include <QPieModelMapper>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML 中: PieModelMapper
继承: QObject

属性

公共功能

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

信号

详细说明

模型映射器可将源自QAbstractItemModel 类的数据模型用作图形的数据源。模型映射器用于在数据模型和QPieSeries 之间创建连接。

模型和饼状序列属性都可用于操作数据。模型映射器可使饼状序列和数据模型保持同步。

属性文档

count : qsizetype

此属性用于保存被映射为饼状序列数据的模型列数或行数。

最小默认值为-1(受模型行数限制)。

访问功能:

qsizetype count() const
void setCount(qsizetype count)

Notifier 信号:

void countChanged()

另请参阅 QPieModelMapper::orientation

first : qsizetype

此属性用于保存模型中包含第一个切分值的列或行。

最小默认值为 0。

访问功能:

qsizetype first() const
void setFirst(qsizetype first)

Notifier 信号:

void firstChanged()

另请参阅 QPieModelMapper::orientation

labelsSection : qsizetype

此属性用于保存模型中与饼的切片标签同步的列或行。

默认值为-1(无效映射)。

访问功能:

qsizetype labelsSection() const
void setLabelsSection(qsizetype labelsSection)

Notifier 信号:

void labelsSectionChanged()

另请参阅 QPieModelMapper::orientation

model : QAbstractItemModel*

该属性包含映射器使用的模型。

访问功能:

QAbstractItemModel *model() const
void setModel(QAbstractItemModel *model)

Notifier 信号:

void modelChanged()

orientation : Qt::Orientation

告诉 modelmapper 如何映射模型中的数据。如果使用Qt::Vertical ,模型的每一行定义一个饼片,模型的列定义饼片的标签或值。当方向设置为Qt::Horizontal 时,模型的每一列定义一个饼片,模型的每一行定义饼片的标签或值。

默认值为Qt::Vertical

访问功能:

Qt::Orientation orientation() const
void setOrientation(Qt::Orientation orientation)

Notifier 信号:

void orientationChanged()

series : QPieSeries*

该属性包含映射器使用的饼系列。

该系列中的所有数据在设置给映射器时都会被丢弃。指定新系列时,旧系列将被断开(但保留其数据)。

访问功能:

QPieSeries *series() const
void setSeries(QPieSeries *series)

通知信号:

void seriesChanged()

valuesSection : qsizetype

此属性用于保存模型中与饼的切片值保持同步的列或行。

默认值为-1(无效映射)。

访问功能:

qsizetype valuesSection() const
void setValuesSection(qsizetype valuesSection)

Notifier 信号:

void valuesSectionChanged()

另请参见 QPieModelMapper::orientation

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