QBarModelMapper Class

The QBarModelMapper class is a model mapper for bar series. More...

Header: #include <QBarModelMapper>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
In QML: BarModelMapper
Inherits: QObject

Properties

Public Functions

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

Signals

Detailed Description

Model mappers enable using a data model derived from the 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.

Property Documentation

count : int

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

The default value is -1 which is also the minimum. The count is limited by the number of model's rows/columns.

Access functions:

int count() const
void setCount(int newCount)

Notifier signal:

void countChanged()

See also QBarModelMapper::orientation.

first : int

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

The minimum and default value is 0.

Access functions:

int first() const
void setFirst(int newFirst)

Notifier signal:

void firstChanged()

See also QBarModelMapper::orientation.

firstBarSetSection : int

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

The default value is -1 (invalid mapping).

Access functions:

int firstBarSetSection() const
void setFirstBarSetSection(int newFirstBarSetSection)

Notifier signal:

void firstBarSetSectionChanged()

See also QBarModelMapper::orientation.

lastBarSetSection : int

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

The default value is -1 (invalid mapping).

Access functions:

int lastBarSetSection() const
void setLastBarSetSection(int newLastBarSetSection)

Notifier signal:

void lastBarSetSectionChanged()

See also QBarModelMapper::orientation.

model : QAbstractItemModel*

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

Access functions:

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

Notifier signal:

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.

The default value is Qt::Vertical

Access functions:

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

Notifier signal:

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.

Access functions:

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

Notifier signal:

void seriesChanged()

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