本页内容

XYModelMapper QML Type

XYSeries 的模型映射器。更多内容...

Import Statement: import QtGraphs
In C++: QXYModelMapper

属性

信号

详细说明

模型映射器允许将从QAbstractItemModel 类派生的数据模型用作图形的数据源。模型映射器用于在线、样条或散点序列之间建立连接。TableModel是该模型的理想选择。

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

另请参阅 XYSeries 。

属性文档

count : qsizetype

模型中作为系列数据映射的行数。默认值为 -1(该数值受模型中行数的限制)。

另请参阅 orientation 。

first : qsizetype

模型中包含该时间序列第一个数据点数据的行。默认值为 0。

另请参阅 orientation 。

model : SomeModel

映射器所使用的数据模型。您需要实现该模型,并将其暴露给 QML。

注意:该 模型必须支持添加和删除行或列,以及修改单元格中的数据。

orientation : orientation

用于告知模型映射器如何将模型中的数据进行映射。如果使用Qt.Vertical ,则模型包含X和Y列,且模型的行定义了数据点;当方向设置为Qt.Horizontal 时,则模型包含X和Y行,且模型的列定义了数据点。

series : XYSeries

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

xSection : qsizetype

模型中包含数据点 x 坐标的段。默认值为 -1(映射无效)。

另请参阅 orientation 。

ySection : qsizetype

模型中包含数据点 y 坐标的段。默认值为 -1(无效映射)。

另请参阅 orientation 。

Signal 文档

countChanged()

当行数发生变化时,会触发此信号。

注意: 相应的处理程序 为onCountChanged 。

firstChanged()

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

注意: 对应的处理程序 为onFirstChanged 。

modelChanged()

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

注意: 相应的处理程序 是onModelChanged 。

seriesChanged()

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

注意: 相应的处理程序 为onSeriesChanged 。

xSectionChanged()

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

注意: 相应的处理程序 为onXSectionChanged 。

ySectionChanged()

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

注意: 相应的处理程序 是onYSectionChanged 。

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