QXYModelMapper Class

The QXYModelMapper class is a model mapper for line, spline, and scatter series. 更多...

头: #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

信号

void countChanged ()
void firstChanged ()
void modelChanged ()
void orientationChanged ()
void seriesChanged ()
void xSectionChanged ()
void ySectionChanged ()

详细描述

模型映射器允许使用的数据模型派生自 QAbstractItemModel class as a data source for a graph. A model mapper is used to create a connection between a line, spline, or scatter series. A TableModel is a natural choice for the model.

Both model and series properties can be used to manipulate the data. The model mapper keeps the series and the data model in sync.

另请参阅 QXYSeries .

特性文档编制

count : qsizetype

This property holds the number of rows of the model that are mapped as the data for series.

The minimum and default value is -1 (the number is limited by the number of rows in the model).

访问函数:

qsizetype count () const
void setCount (qsizetype count )

通知程序信号:

void countChanged ()

另请参阅 QXYModelMapper::orientation .

first : qsizetype

This property holds the row of the model that contains the data for the first point of the series.

最小且默认值为 0。

访问函数:

qsizetype 第一 () const
void setFirst (qsizetype first )

通知程序信号:

void firstChanged ()

另请参阅 QXYModelMapper::orientation .

model : QAbstractItemModel *

此特性保持映射器使用的模型。

访问函数:

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

通知程序信号:

void modelChanged ()

orientation : Qt::Orientation

Tells the modelmapper how to map data from a model. If Qt::Vertical is used, each of the model's columns defines a bar set, and the model's rows define the categories. When the orientation is set to Qt::Horizontal , each of the model's rows defines a bar set, and the model's columns define categories.

默认值为 Qt::Vertical

访问函数:

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

通知程序信号:

void orientationChanged ()

series : QXYSeries *

This property holds the series that is used by the mapper.

All the data in the series is discarded when it is set to the mapper. When a new series is specified, the old series is disconnected (but it preserves its data).

访问函数:

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

通知程序信号:

void seriesChanged ()

xSection : qsizetype

This property holds the section of the model that contains the x-coordinates of data points.

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

访问函数:

qsizetype xSection () const
void setXSection (qsizetype xSection )

通知程序信号:

void xSectionChanged ()

另请参阅 QXYModelMapper::orientation .

ySection : qsizetype

This property holds the section of the model that contains the y-coordinates of data points.

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

访问函数:

qsizetype ySection () const
void setYSection (qsizetype ySection )

通知程序信号:

void ySectionChanged ()

另请参阅 QXYModelMapper::orientation .