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 ()