- Qt 6.11
- Qt Graphs
- C++ Classes
- QtGraphs
- QPieModelMapper
- Qt Graphs | Commercial or GPLv3

# QPieModelMapper Class

The QPieModelMapper is a model mapper for pie series. More...

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

- List of all members, including inherited members
- QPieModelMapper is part of Qt Graphs C++ Classes for 2D.

## Properties

count : qsizetype first : qsizetype labelsSection : qsizetype model : QAbstractItemModel* | orientation : Qt::Orientation series : QPieSeries* valuesSection : qsizetype

## Public Functions

qsizetype | count() const
qsizetype | first() const
qsizetype | labelsSection() const
QAbstractItemModel * | model() const
Qt::Orientation | orientation() const
QPieSeries * | series() const
void | setCount(qsizetype count)
void | setFirst(qsizetype first)
void | setLabelsSection(qsizetype labelsSection)
void | setModel(QAbstractItemModel *model)
void | setOrientation(Qt::Orientation orientation)
void | setSeries(QPieSeries *series)
void | setValuesSection(qsizetype valuesSection)
qsizetype | valuesSection() const

## Signals

void | countChanged()
void | firstChanged()
void | labelsSectionChanged()
void | modelChanged()
void | orientationChanged()
void | seriesChanged()
void | valuesSectionChanged()

## 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 QPieSeries.

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

## Property Documentation

### count : qsizetype

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

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

Access functions:

qsizetype | count() const
void | setCount(qsizetype count)

Notifier signal:

void | countChanged()

See also QPieModelMapper::orientation.

### first : qsizetype

This property holds the column or row of the model that contains the first slice value.

The minimum and default value is 0.

Access functions:

qsizetype | first() const
void | setFirst(qsizetype first)

Notifier signal:

void | firstChanged()

See also QPieModelMapper::orientation.

### labelsSection : qsizetype

This property holds the column or row of the model that is kept in sync with the labels of the pie's slices.

The default value is -1 (invalid mapping).

Access functions:

qsizetype | labelsSection() const
void | setLabelsSection(qsizetype labelsSection)

Notifier signal:

void | labelsSectionChanged()

See also QPieModelMapper::orientation.

### model : QAbstractItemModel*

This property holds the 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 rows defines a pie slice, and the model's columns define the label or the value of the pie slice. When the orientation is set to `Qt::Horizontal`, each of the model's columns defines a pie slice, and the model's rows define the label or the value of the pie slice.

The default value is `Qt::Vertical`

Access functions:

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

Notifier signal:

void | orientationChanged()

### series : QPieSeries*

This property holds the pie 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:

QPieSeries * | series() const
void | setSeries(QPieSeries *series)

Notifier signal:

void | seriesChanged()

### valuesSection : qsizetype

This property holds the column or row of the model that is kept in sync with the values of the pie's slices.

The default value is -1 (invalid mapping).

Access functions:

qsizetype | valuesSection() const
void | setValuesSection(qsizetype valuesSection)

Notifier signal:

void | valuesSectionChanged()

See also QPieModelMapper::orientation.