QHBarModelMapper Class

QHBarModelMapper 类是条形序列的水平模型映射器。更多

Header: #include <QHBarModelMapper>
In QML: HBarModelMapper
Inherits: QObject

属性

公共功能

QHBarModelMapper(QObject *parent = nullptr)
int columnCount() const
int firstBarSetRow() const
int firstColumn() const
int lastBarSetRow() const
QAbstractItemModel *model() const
QAbstractBarSeries *series() const
void setColumnCount(int columnCount)
void setFirstBarSetRow(int firstBarSetRow)
void setFirstColumn(int firstColumn)
void setLastBarSetRow(int lastBarSetRow)
void setModel(QAbstractItemModel *model)
void setSeries(QAbstractBarSeries *series)

信号

详细说明

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

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

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

另请参阅 QVBarModelMapper

属性文档

columnCount : int

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

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

访问功能:

int columnCount() const
void setColumnCount(int columnCount)

通知信号:

firstBarSetRow : int

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

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

访问功能:

int firstBarSetRow() const
void setFirstBarSetRow(int firstBarSetRow)

通知信号:

firstColumn : int

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

最小默认值为 0。

访问功能:

int firstColumn() const
void setFirstColumn(int firstColumn)

通知信号:

lastBarSetRow : int

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

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

访问功能:

int lastBarSetRow() const
void setLastBarSetRow(int lastBarSetRow)

通知信号:

model : QAbstractItemModel*

定义映射器使用的模型。

访问功能:

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

通知信号

void modelReplaced()

series : QAbstractBarSeries*

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

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

访问功能:

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

Notifier 信号:

成员函数文档

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

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

[signal] void QHBarModelMapper::columnCountChanged()

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

注: 属性columnCount 的通知信号。

[signal] void QHBarModelMapper::firstBarSetRowChanged()

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

注: 属性firstBarSetRow 的通知信号。

[signal] void QHBarModelMapper::firstColumnChanged()

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

注: 属性firstColumn 的通知信号。

[signal] void QHBarModelMapper::lastBarSetRowChanged()

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

注: 属性lastBarSetRow 的通知信号。

[signal] void QHBarModelMapper::modelReplaced()

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

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

[signal] void QHBarModelMapper::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.