QVBarModelMapper Class

QVBarModelMapper 类是条形序列的垂直模型映射器。更多

Header: #include <QVBarModelMapper>
In QML: VBarModelMapper
Inherits: QObject

属性

公共功能

QVBarModelMapper(QObject *parent = nullptr)
int firstBarSetColumn() const
int firstRow() const
int lastBarSetColumn() const
QAbstractItemModel *model() const
int rowCount() const
QAbstractBarSeries *series() const
void setFirstBarSetColumn(int firstBarSetColumn)
void setFirstRow(int firstRow)
void setLastBarSetColumn(int lastBarSetColumn)
void setModel(QAbstractItemModel *model)
void setRowCount(int rowCount)
void setSeries(QAbstractBarSeries *series)

信号

详细说明

模型映射器可将源自QAbstractItemModel 类的数据模型用作图表的数据源。垂直模型映射器用于在数据模型和QAbstractBarSeries 之间创建连接,以便数据模型中的每一列都定义一个条形集,每一行都映射到条形序列中的一个类别。

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

模型映射器确保条形序列中的所有条形集大小相等。因此,从条形图组中添加或删除一个值会导致条形图系列中的所有条形图组发生相同的变化。

更多信息,请参阅带 Widgets 图库的图表

另请参阅 QHBarModelMapper

属性文档

firstBarSetColumn : int

该属性用于保存作为第一个条形图集数据源的模型列。

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

访问功能:

int firstBarSetColumn() const
void setFirstBarSetColumn(int firstBarSetColumn)

通知信号:

firstRow : int

此属性用于保存模型中包含条形图系列中条形图组的第一个值的行。

最小默认值为 0。

访问功能:

int firstRow() const
void setFirstRow(int firstRow)

通知信号:

lastBarSetColumn : int

此属性保存模型中用作最后一个条形图集数据源的列。

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

访问功能:

int lastBarSetColumn() const
void setLastBarSetColumn(int lastBarSetColumn)

通知信号:

model : QAbstractItemModel*

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

访问功能:

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

Notifier 信号:

void modelReplaced()

rowCount : int

此属性用于保存被映射为条形图数据的模型行数。

最小值和默认值均为-1(数量限制为模型中的行数)。

访问功能:

int rowCount() const
void setRowCount(int rowCount)

通知信号:

series : QAbstractBarSeries*

该属性包含映射器使用的柱状图系列。

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

访问功能:

QAbstractBarSeries *series() const
void setSeries(QAbstractBarSeries *series)

Notifier 信号:

成员函数文档

[explicit] QVBarModelMapper::QVBarModelMapper(QObject *parent = nullptr)

构造一个parent 的子映射器对象。

[signal] void QVBarModelMapper::firstBarSetColumnChanged()

当第一个条形图设置列发生变化时发出该信号。

注: 属性firstBarSetColumn 的通知信号。

[signal] void QVBarModelMapper::firstRowChanged()

该信号在第一行发生变化时发出。

注: 属性firstRow 的通知信号。

[signal] void QVBarModelMapper::lastBarSetColumnChanged()

当最后一个条形图设置列发生变化时发出该信号。

注: 属性lastBarSetColumn 的通知信号。

[signal] void QVBarModelMapper::modelReplaced()

当映射器所连接的模型发生变化时会发出该信号。

注: 用于属性model 的 Notifier 信号。

[signal] void QVBarModelMapper::rowCountChanged()

行数发生变化时会发出该信号。

注: 属性rowCount 的通知信号。

[signal] void QVBarModelMapper::seriesReplaced()

当映射器所连接的条形图系列发生变化时会发出该信号。

注: 用于属性series 的通知信号。

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