QBarModelMapper Class

The QBarModelMapper class is a model mapper for bar series. 更多...

头: #include <QBarModelMapper>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML: BarModelMapper
继承: QObject

特性

公共函数

qsizetype count () const
qsizetype first () const
qsizetype firstBarSetSection () const
qsizetype lastBarSetSection () const
QAbstractItemModel * model () const
Qt::Orientation orientation () const
QBarSeries * series () const
void setCount (qsizetype newCount )
void setFirst (qsizetype newFirst )
void setFirstBarSetSection (qsizetype newFirstBarSetSection )
void setLastBarSetSection (qsizetype newLastBarSetSection )
void setModel (QAbstractItemModel * model )
void setOrientation (Qt::Orientation orientation )
void setSeries (QBarSeries * series )

信号

void countChanged ()
void firstBarSetSectionChanged ()
void firstChanged ()
void lastBarSetSectionChanged ()
void modelChanged ()
void orientationChanged ()
void seriesChanged ()

详细描述

模型映射器允许使用的数据模型派生自 QAbstractItemModel class as a data source for a graph. A model mapper is used to create a connection between a data model and QBarSeries .

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

The model mapper ensures that all the bar sets in the bar series have equal sizes. Therefore, adding or removing a value from a bar set causes the same change to be made in all the bar sets in the bar series.

特性文档编制

count : qsizetype

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

默认值为 -1 which is also the minimum. The count is limited by the number of model's rows/columns.

访问函数:

qsizetype count () const
void setCount (qsizetype newCount )

通知程序信号:

void countChanged ()

另请参阅 QBarModelMapper::orientation .

first : qsizetype

This property holds the row or column of the model that contains the first values of the bar sets in the bar series.

最小且默认值为 0。

访问函数:

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

通知程序信号:

void firstChanged ()

另请参阅 QBarModelMapper::orientation .

firstBarSetSection : qsizetype

This property holds the section of the model that is used as the data source for the first bar set.

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

访问函数:

qsizetype firstBarSetSection () const
void setFirstBarSetSection (qsizetype newFirstBarSetSection )

通知程序信号:

void firstBarSetSectionChanged ()

另请参阅 QBarModelMapper::orientation .

lastBarSetSection : qsizetype

This property holds the section of the model that is used as the data source for the last bar set.

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

访问函数:

qsizetype lastBarSetSection () const
void setLastBarSetSection (qsizetype newLastBarSetSection )

通知程序信号:

void lastBarSetSectionChanged ()

另请参阅 QBarModelMapper::orientation .

model : QAbstractItemModel *

This property holds the data model that is used by the mapper.

访问函数:

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 : QBarSeries *

This property holds the bar 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.

访问函数:

QBarSeries * series () const
void setSeries (QBarSeries * series )

通知程序信号:

void seriesChanged ()