Qt 5.7 | Qt Charts | QML Types | HBarModelMapper QML Type

Qt 5.7.1 Reference Documentation

# HBarModelMapper QML Type

Horizontal model mapper for bar series. More...

Import Statement: | import QtCharts 2.1
Instantiates: | QHBarModelMapper

- List of all members, including inherited members

## Properties

- columnCount : int
- firstBarSetRow : int
- firstColumn : int
- lastBarSetRow : int
- model : SomeModel
- series : AbstractBarSeries

## Detailed Description

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

The following QML example would create a bar series with three bar sets (assuming the model has at least four rows). Each bar set would contain data starting from column 1. The name of a set would be defined by the vertical header (of the row).

      BarSeries {
          HBarModelMapper {
              model: myCustomModel // QAbstractItemModel derived implementation
              firstBarSetRow: 1
              lastBarSetRow: 3
              firstColumn: 1
          }
      }

## Property Documentation

columnCount : int

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

firstBarSetRow : int

Defines which column of the model is used as the data source for the first bar set. The default value is -1 (invalid mapping).

firstColumn : int

Defines which column of the model contains the first values of the QBarSets in the series. The default value is 0.

lastBarSetRow : int

Defines which column of the model is used as the data source for the last bar set. The 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 : AbstractBarSeries

Defines the AbstractBarSeries based object that is used by the mapper. 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).