QHPieModelMapper Class
QHPieModelMapper 是一个用于饼图系列的水平模型映射器。更多内容...
| Header: | #include <QHPieModelMapper> |
| In QML: | HPieModelMapper |
| Inherits: | QPieModelMapper |
| Status: | Deprecated |
该类已弃用。我们强烈建议不要在新代码中使用它。
属性
|
公共函数
| QHPieModelMapper(QObject *parent = nullptr) | |
| int | columnCount() const |
| int | firstColumn() const |
| int | labelsRow() const |
| QAbstractItemModel * | model() const |
| QPieSeries * | series() const |
| void | setColumnCount(int columnCount) |
| void | setFirstColumn(int firstColumn) |
| void | setLabelsRow(int labelsRow) |
| void | setModel(QAbstractItemModel *model) |
| void | setSeries(QPieSeries *series) |
| void | setValuesRow(int valuesRow) |
| int | valuesRow() const |
信号
| void | columnCountChanged() |
| void | firstColumnChanged() |
| void | labelsRowChanged() |
| void | modelReplaced() |
| void | seriesReplaced() |
| void | valuesRowChanged() |
详细说明
模型映射器允许将源自QAbstractItemModel 类的数据模型用作图表的数据源。水平模型映射器用于在数据模型与QPieSeries 之间建立连接,使得数据模型中的每一列都定义一个扇区,每一行则映射到该扇区的标签或数值。
既可以使用模型属性,也可以使用饼图系列属性来操作数据。模型映射器会保持饼图系列与数据模型之间的同步。
属性文档
columnCount : int
该属性存储了模型中映射为饼图系列数据列的数量。
其最小值和默认值为 -1(数值上限为模型中的列数)。
访问函数:
| int | columnCount() const |
| void | setColumnCount(int columnCount) |
通知信号:
| void | columnCountChanged() |
firstColumn : int
该属性表示模型中包含第一个切片值的列。
其最小值和默认值均为 0。
访问函数:
| int | firstColumn() const |
| void | setFirstColumn(int firstColumn) |
通知器信号:
| void | firstColumnChanged() |
labelsRow : int
该属性存储了与饼图扇区标签保持同步的模型行。
默认值为 -1(映射无效)。
访问函数:
| int | labelsRow() const |
| void | setLabelsRow(int labelsRow) |
通知信号:
| void | labelsRowChanged() |
model : QAbstractItemModel*
该属性保存了映射器所使用的模型。
访问函数:
| QAbstractItemModel * | model() const |
| void | setModel(QAbstractItemModel *model) |
通知器信号:
| void | modelReplaced() |
series : QPieSeries*
该属性存储映射器所使用的饼图系列。
当该系列被设置为映射器时,其中的所有数据都会被丢弃。当指定新系列时,旧系列将被断开连接(但其数据仍会被保留)。
访问函数:
| QPieSeries * | series() const |
| void | setSeries(QPieSeries *series) |
通知器信号:
| void | seriesReplaced() |
valuesRow : int
该属性存储了与饼图扇区值保持同步的模型行。
默认值为 -1(映射无效)。
访问函数:
| int | valuesRow() const |
| void | setValuesRow(int valuesRow) |
通知器信号:
| void | valuesRowChanged() |
成员函数文档
[explicit] QHPieModelMapper::QHPieModelMapper(QObject *parent = nullptr)
构建一个作为parent 子节点的映射器对象。
[signal] void QHPieModelMapper::columnCountChanged()
当列数发生变化时,会发出此信号。
注意: 这是属性columnCount的通知器 信号。
[signal] void QHPieModelMapper::firstColumnChanged()
当第一列发生变化时,会发出此信号。
注意: 这是属性firstColumn的通知器 信号。
int QHPieModelMapper::labelsRow() const
返回与饼图扇区标签保持同步的模型行。
注意: 这是 labelsRow 属性的获取 函数。
另请参阅 setLabelsRow()。
[signal] void QHPieModelMapper::labelsRowChanged()
当标签行发生变化时,会触发此信号。
注意: 这是属性labelsRow的通知器 信号。
[signal] void QHPieModelMapper::modelReplaced()
当映射器所连接的模型发生变化时,会触发此信号。
注意: 这是属性model的通知器 信号。
[signal] void QHPieModelMapper::seriesReplaced()
当映射器所连接的系列发生变化时,会触发此信号。
注意: 这是属性series的通知器 信号。
void QHPieModelMapper::setLabelsRow(int labelsRow)
将与饼图扇区标签保持同步的模型行设置为labelsRow 。
注意: 这是属性labelsRow 的设置 函数。
另请参阅 labelsRow()。
void QHPieModelMapper::setValuesRow(int valuesRow)
将与饼图扇区值保持同步的模型行设置为valuesRow 。
注意: 这是属性 `valuesRow`的设置 函数。
另请参阅 valuesRow()。
int QHPieModelMapper::valuesRow() const
返回与饼图扇区值保持同步的模型行。
注意: 这是属性 valuesRow 的获取 函数。
另请参阅 setValuesRow()。
[signal] void QHPieModelMapper::valuesRowChanged()
当“values”行发生变化时,会触发此信号。
注意: 这是属性valuesRow 的Notifier 信号。
© 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.