HPieModelMapper QML Type | Qt Charts 5.8

Qt 5.8 | Qt Charts | QML Types | HPieModelMapper QML Type

Qt 5.8.0 Reference Documentation

# HPieModelMapper QML Type

Horizontal model mapper for pie series. More...

Import Statement: | import QtCharts 2.2
Instantiates: | QHPieModelMapper

- List of all members, including inherited members

## Properties

- columnCount : int
- firstColumn : int
- labelsRow : int
- model : SomeModel
- series : PieSeries
- valuesRow : int

## Detailed Description

HPieModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries data API to manipulate data. HPieModelMapper keeps the Pie and the model in sync.

The following QML example would create a pie series with four slices (assuming the model has at least five columns). Each slice would contain a label from row 1 and a value from row 2.

      HPieModelMapper {
          series: pieSeries
          model: customModel
          labelsRow: 1
          valuesRow: 2
          firstColumn: 1
          columnCount: 4
      }

## Property Documentation

columnCount : int

Defines the number of columns of the model that are mapped as the data for QPieSeries. The default value is -1 (count limited by the number of columns in the model)

firstColumn : int

Defines which column of the model contains the first slice value. The default value is 0.

labelsRow : int

Defines which row of the model is kept in sync with the labels of the pie's slices Default value is: -1 (invalid mapping)

model : SomeModel

The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying the data of the cells.

series : PieSeries

Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper. When new series is specified the old series is disconnected (it preserves its data).

valuesRow : int

Defines which row of the model is kept in sync with the values of the pie's slices. Default value is: -1 (invalid mapping).