VPieModelMapper QML Type

Vertical model mapper for pie series. More...

Import Statement: import QtCharts 2.1
Instantiates: QVPieModelMapper


Detailed Description

VPieModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries data API to manipulate data. VPieModelMapper 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 rows). Each slice would contain a label from column 1 and a value from column 2.

VPieModelMapper {
    series: pieSeries
    model: customModel
    labelsColumn: 1
    valuesColumn: 2
    firstRow: 1
    rowCount: 4

Property Documentation

columnCount : int

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

firstRow : int

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

labelsColumn : int

Defines which column 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).

valuesColumn : int

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

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