- Qt 6.11
- Qt Charts
- C++ Classes
- QHPieModelMapper
- Qt Charts | Commercial or GPLv3

# QHPieModelMapper Class

The QHPieModelMapper is a horizontal model mapper for pie series. More...

Header: | `#include <QHPieModelMapper>`
In QML: | HPieModelMapper
Inherits: | QPieModelMapper

- List of all members, including inherited members

## Properties

columnCount : int firstColumn : int labelsRow : int | model : QAbstractItemModel* series : QPieSeries* valuesRow : int

## Public Functions

| QHPieModelMapper(QObject *parent = nullptr)
int | columnCount() const
int | firstColumn() const
int | labelsRow() const
QAbstractItemModel * | model() const
QPieSeries * | series() const
void | setColumnCount(int columnCount)
void | setFirstColumn(int firstColumn)
void | setLabelsRow(int labelsRow)
void | setModel(QAbstractItemModel *model)
void | setSeries(QPieSeries *series)
void | setValuesRow(int valuesRow)
int | valuesRow() const

## Signals

void | columnCountChanged()
void | firstColumnChanged()
void | labelsRowChanged()
void | modelReplaced()
void | seriesReplaced()
void | valuesRowChanged()

## Detailed Description

Model mappers enable using a data model derived from the QAbstractItemModel class as a data source for a chart. A horizontal model mapper is used to create a connection between a data model and QPieSeries, so that each column in the data model defines a pie slice and each row maps to the label or the value of the pie slice.

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

### columnCount : int

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

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

Access functions:

int | columnCount() const
void | setColumnCount(int columnCount)

Notifier signal:

void | columnCountChanged()

### firstColumn : int

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

The minimum and default value is 0.

Access functions:

int | firstColumn() const
void | setFirstColumn(int firstColumn)

Notifier signal:

void | firstColumnChanged()

### labelsRow : int

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

int | labelsRow() const
void | setLabelsRow(int labelsRow)

Notifier signal:

void | labelsRowChanged()

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

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

### valuesRow : int

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

int | valuesRow() const
void | setValuesRow(int valuesRow)

Notifier signal:

void | valuesRowChanged()

## Member Function Documentation

### `[explicit]` QHPieModelMapper::QHPieModelMapper(QObject *parent = nullptr)

Constructs a mapper object that is a child of parent.

### `[signal]` void QHPieModelMapper::columnCountChanged()

This signal is emitted when the number of columns changes.

Note: Notifier signal for property columnCount.

### `[signal]` void QHPieModelMapper::firstColumnChanged()

This signal is emitted when the first column changes.

Note: Notifier signal for property firstColumn.

### int QHPieModelMapper::labelsRow() const

Returns the row of the model that is kept in sync with the labels of the pie's slices.

Note: Getter function for property labelsRow.

See also setLabelsRow().

### `[signal]` void QHPieModelMapper::labelsRowChanged()

This signal is emitted when the labels row changes.

Note: Notifier signal for property labelsRow.

### `[signal]` void QHPieModelMapper::modelReplaced()

This signal is emitted when the model that the mapper is connected to changes.

Note: Notifier signal for property model.

### `[signal]` void QHPieModelMapper::seriesReplaced()

This signal is emitted when the series that the mapper is connected to changes.

Note: Notifier signal for property series.

### void QHPieModelMapper::setLabelsRow(int labelsRow)

Sets the model row that is kept in sync with the pie slices' labels to labelsRow.

Note: Setter function for property labelsRow.

See also labelsRow().

### void QHPieModelMapper::setValuesRow(int valuesRow)

Sets the model row that is kept in sync with the pie slices' values to valuesRow.

Note: Setter function for property valuesRow.

See also valuesRow().

### int QHPieModelMapper::valuesRow() const

Returns the row of the model that is kept in sync with the values of the pie's slices.

Note: Getter function for property valuesRow.

See also setValuesRow().

### `[signal]` void QHPieModelMapper::valuesRowChanged()

This signal is emitted when the values row changes.

Note: Notifier signal for property valuesRow.