- Qt 6.6
- Qt Graphs
- QML Types
- QtGraphs (Technical Preview)
- ItemModelBarDataProxy
- Qt Graphs | Commercial or GPLv3

# ItemModelBarDataProxy QML Type

Proxy class for presenting data in item models with Bars3D. More...

Import Statement: | import QtGraphs 6.6
Instantiates: | QItemModelBarDataProxy
Inherits: | BarDataProxy
Status: | Technical Preview

- List of all members, including inherited members

## Properties

- autoColumnCategories : bool
- autoRowCategories : bool
- columnCategories : list<String>
- columnRole : string
- columnRolePattern : regExp
- columnRoleReplace : string
- itemModel : model
- multiMatchBehavior : ItemModelBarDataProxy.MultiMatchBehavior
- rotationRole : string
- rotationRolePattern : regExp
- rotationRoleReplace : string
- rowCategories : list<String>
- rowRole : string
- rowRolePattern : regExp
- rowRoleReplace : string
- useModelCategories : bool
- valueRole : string
- valueRolePattern : regExp
- valueRoleReplace : string

## Detailed Description

This type allows you to use AbstractItemModel derived models as a data source for Bars3D.

Data is resolved asynchronously whenever the mapping or the model changes. QBarDataProxy::arrayReset() is emitted when the data has been resolved.

For ItemModelBarDataProxy enums, see QItemModelBarDataProxy::MultiMatchBehavior.

For more details, see QItemModelBarDataProxy documentation.

Usage example:

     ItemModelBarDataProxy {
         itemModel: model // E.g. a list model defined elsewhere containing yearly expenses data.
         // Mapping model roles to bar series rows, columns, and values.
         rowRole: "year"
         columnRole: "city"
         valueRole: "expenses"
         rowCategories: ["2020", "2021", "2022", "2023"]
         columnCategories: ["Oulu", "Rauma", "Helsinki", "Tampere"]
     }

See also BarDataProxy and Qt Graphs Data Handling.

## Property Documentation

autoColumnCategories : bool

When set to `true`, the mapping ignores any explicitly set column categories and overwrites them with automatically generated ones whenever the data from model is resolved. Defaults to `true`.

autoRowCategories : bool

When set to `true`, the mapping ignores any explicitly set row categories and overwrites them with automatically generated ones whenever the data from the model is resolved. Defaults to `true`.

columnCategories : list<String>

The column categories of the mapping. Only items with column role values that are found in this list are included when the data is resolved. The columns are ordered in the same order as they are in this list.

columnRole : string

The item model role to map into column category.

columnRolePattern : regExp

When set, a search and replace is done on the value mapped by column role before it is used as a column category. This property specifies the regular expression to find the portion of the mapped value to replace and columnRoleReplace property contains the replacement string. This is useful for example in parsing row and column categories from a single timestamp field in the item model.

See also columnRole and columnRoleReplace.

columnRoleReplace : string

This property defines the replace content to be used in conjunction with columnRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegularExpression &rx, const QString &after) function documentation.

See also columnRole and columnRolePattern.

itemModel : model

The item model.

multiMatchBehavior : ItemModelBarDataProxy.MultiMatchBehavior

Defines how multiple matches for each row/column combination are handled. Defaults to ItemModelBarDataProxy.MMBLast. The chosen behavior affects both bar value and rotation.

For example, you might have an item model with timestamped data taken at irregular intervals and you want to visualize total value of data items on each day with a bar graph. This can be done by specifying row and column categories so that each bar represents a day, and setting multiMatchBehavior to ItemModelBarDataProxy.MMBCumulative.

rotationRole : string

The item model role to map into bar rotation angle.

rotationRolePattern : regExp

When set, a search and replace is done on the value mapped by rotation role before it is used as a bar rotation angle. This property specifies the regular expression to find the portion of the mapped value to replace and rotationRoleReplace property contains the replacement string.

See also rotationRole and rotationRoleReplace.

rotationRoleReplace : string

This property defines the replace content to be used in conjunction with rotationRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegularExpression &rx, const QString &after) function documentation.

See also rotationRole and rotationRolePattern.

rowCategories : list<String>

The row categories of the mapping. Only items with row role values that are found in this list are included when the data is resolved. The rows are ordered in the same order as they are in this list.

rowRole : string

The item model role to map into row category.

rowRolePattern : regExp

When set, a search and replace is done on the value mapped by row role before it is used as a row category. This property specifies the regular expression to find the portion of the mapped value to replace and rowRoleReplace property contains the replacement string. This is useful for example in parsing row and column categories from a single timestamp field in the item model.

See also rowRole and rowRoleReplace.

rowRoleReplace : string

This property defines the replace content to be used in conjunction with rowRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegularExpression &rx, const QString &after) function documentation.

See also rowRole and rowRolePattern.

useModelCategories : bool

When set to `true`, the mapping ignores row and column roles and categories, and uses the rows and columns from the model instead. Row and column headers are used for row and column labels. Defaults to `false`.

valueRole : string

The item model role to map into bar value.

valueRolePattern : regExp

When set, a search and replace is done on the value mapped by value role before it is used as a bar value. This property specifies the regular expression to find the portion of the mapped value to replace and valueRoleReplace property contains the replacement string.

See also valueRole and valueRoleReplace.

valueRoleReplace : string

This property defines the replace content to be used in conjunction with valueRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegularExpression &rx, const QString &after) function documentation.

See also valueRole and valueRolePattern.