本页内容

QHXYModelMapper Class

QHXYModelMapper 类是一个用于直线、样条和散点序列的水平模型映射器。更多内容...

Header: #include <QHXYModelMapper>
In QML: HXYModelMapper
Inherits: QXYModelMapper
Status: Deprecated

该类已弃用。我们强烈建议不要在新的代码中使用它。

属性

公共函数

QHXYModelMapper(QObject *parent = nullptr)
int columnCount() const
int firstColumn() const
QAbstractItemModel *model() const
QXYSeries *series() const
void setColumnCount(int columnCount)
void setFirstColumn(int firstColumn)
void setModel(QAbstractItemModel *model)
void setSeries(QXYSeries *series)
void setXRow(int xRow)
void setYRow(int yRow)
int xRow() const
int yRow() const

信号

详细说明

模型映射器允许将源自QAbstractItemModel 类的数据模型用作图表的数据源。水平模型映射器用于在线、样条或散点系列与数据模型之间建立连接,该数据模型包含用于坐标的X 和Y行,并将XYSeries 的数据点作为列存储。TableModel是该模型的自然选择。

既可以使用模型属性,也可以使用系列属性来操作数据。模型映射器会保持系列与数据模型之间的同步。

另请参阅 QVXYModelMapper 、QXYSeries 以及“带小部件的图表”图库。

属性文档

columnCount : int

该属性存储了模型中映射为系列数据的列数。

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

访问函数:

int columnCount() const
void setColumnCount(int columnCount)

通知信号:

firstColumn : int

该属性保存了模型中包含该时间序列第一个数据点数据的列。

其最小值和默认值均为 0。

访问函数:

int firstColumn() const
void setFirstColumn(int firstColumn)

通知信号:

model : QAbstractItemModel*

该属性存储映射器所使用的模型。

访问函数:

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

通知器信号:

void modelReplaced()

series : QXYSeries*

该属性存储映射器所使用的系列。

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

访问函数:

QXYSeries *series() const
void setSeries(QXYSeries *series)

通知信号:

xRow : int

该属性保存了模型中包含数据点 x 坐标的行。

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

访问函数:

int xRow() const
void setXRow(int xRow)

通知信号:

void xRowChanged()

yRow : int

该属性存储模型中包含数据点 y 坐标的行。

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

访问函数:

int yRow() const
void setYRow(int yRow)

通知信号:

void yRowChanged()

成员函数文档

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

构建一个作为parent 子节点的映射器对象。

[signal] void QHXYModelMapper::columnCountChanged()

当列数发生变化时,会发出此信号。

注意: 这是属性columnCount的通知器 信号。

[signal] void QHXYModelMapper::firstColumnChanged()

当第一列发生变化时,会触发此信号。

注意: 这是属性firstColumn的通知器 信号。

[signal] void QHXYModelMapper::modelReplaced()

当映射器所连接的模型发生变化时,会触发此信号。

注意: 这是属性model的通知器 信号。

[signal] void QHXYModelMapper::seriesReplaced()

当映射器所连接的系列发生变化时,会发出此信号。

注意: 这是属性series的通知器 信号。

[signal] void QHXYModelMapper::xRowChanged()

当包含数据点 x 坐标的行发生变化时,会发出此信号。

注意: 这是属性xRow 的Notifier 信号。

[signal] void QHXYModelMapper::yRowChanged()

当包含数据点 y 坐标的行发生变化时,会触发此信号。

注意: 这是属性yRow的通知器 信号。

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