QXYModelMapper Class

QXYModelMapper 类是线性、样条和散点序列的模型映射器。更多

Header: #include <QXYModelMapper>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML 中: XYModelMapper
继承: QObject

属性

公共功能

qsizetype count() const
qsizetype first() const
QAbstractItemModel *model() const
Qt::Orientation orientation() const
QXYSeries *series() const
void setCount(qsizetype count)
void setFirst(qsizetype first)
void setModel(QAbstractItemModel *model)
void setOrientation(Qt::Orientation orientation)
void setSeries(QXYSeries *series)
void setXSection(qsizetype xSection)
void setYSection(qsizetype ySection)
qsizetype xSection() const
qsizetype ySection() const

信号

详细说明

模型映射器可将源自QAbstractItemModel 类的数据模型用作图形的数据源。模型映射器用于在直线、样条线或散点序列之间创建连接。模型是模型的自然选择。

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

另请参见 QXYSeries

属性文档

count : qsizetype

该属性用于保存被映射为序列数据的模型行数。

最小默认值为-1(该数值受模型行数限制)。

访问功能:

qsizetype count() const
void setCount(qsizetype count)

Notifier 信号:

void countChanged()

另请参阅 QXYModelMapper::orientation

first : qsizetype

该属性用于保存模型中包含序列第一点数据的行。

最小默认值为 0。

访问功能:

qsizetype first() const
void setFirst(qsizetype first)

通知信号:

void firstChanged()

另请参阅 QXYModelMapper::orientation

model : QAbstractItemModel*

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

访问功能:

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

Notifier 信号:

void modelChanged()

orientation : Qt::Orientation

告诉 modelmapper 如何映射模型中的数据。如果使用Qt::Vertical ,模型的每一列定义一个条形集,模型的行定义类别。当方向设置为Qt::Horizontal 时,模型的每一行定义一个条形集,模型的列定义类别。

默认值为Qt::Vertical

访问功能:

Qt::Orientation orientation() const
void setOrientation(Qt::Orientation orientation)

通知信号:

void orientationChanged()

series : QXYSeries*

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

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

访问功能:

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

通知信号:

void seriesChanged()

xSection : qsizetype

该属性用于保存模型中包含数据点 x 坐标的部分。

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

访问功能:

qsizetype xSection() const
void setXSection(qsizetype xSection)

Notifier 信号:

void xSectionChanged()

另请参见 QXYModelMapper::orientation

ySection : qsizetype

该属性用于保存模型中包含数据点 Y 坐标的部分。

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

访问功能:

qsizetype ySection() const
void setYSection(qsizetype ySection)

Notifier 信号:

void ySectionChanged()

另请参见 QXYModelMapper::orientation

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