QItemModelScatterDataProxy

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

Inheritance diagram of PySide6.QtDataVisualization.QItemModelScatterDataProxy

Synopsis

Functions

Detailed Description

QItemModelScatterDataProxy allows you to use QAbstractItemModel derived models as a data source for Q3DScatter . It maps roles of QAbstractItemModel to the XYZ-values of Q3DScatter points.

The data is resolved asynchronously whenever the mapping or the model changes. is emitted when the data has been resolved. However, inserts, removes, and single data item changes after the model initialization are resolved synchronously, unless the same frame also contains a change that causes the whole model to be resolved.

Mapping ignores rows and columns of the QAbstractItemModel and treats all items equally. It requires the model to provide roles for the data items that can be mapped to X, Y, and Z-values for the scatter points.

For example, assume that you have a custom QAbstractItemModel for storing various measurements done on material samples, providing data for roles such as “density”, “hardness”, and “conductivity”. You could visualize these properties on a scatter graph using this proxy:

// Map "density" value to X-axis, "hardness" to Y-axis and "conductivity" to Z-axis.
QItemModelScatterDataProxy *proxy = new QItemModelScatterDataProxy(customModel,
                                                                   QStringLiteral("density"),
                                                                   QStringLiteral("hardness"),
                                                                   QStringLiteral("conductivity"));

If the fields of the model do not contain the data in the exact format you need, you can specify a search pattern regular expression and a replace rule for each role to get the value in a format you need. For more information how the replace using regular expressions works, see replace (const QRegularExpression &rx, const QString &after) function documentation. Note that using regular expressions has an impact on the performance, so it’s more efficient to utilize item models where doing search and replace is not necessary to get the desired values.

For example about using the search patterns in conjunction with the roles, see ItemModelBarDataProxy usage in Qt Quick 2 Bars Example .

class PySide6.QtDataVisualization.QItemModelScatterDataProxy(itemModel[, parent=None])

PySide6.QtDataVisualization.QItemModelScatterDataProxy(itemModel, xPosRole, yPosRole, zPosRole[, parent=None])

PySide6.QtDataVisualization.QItemModelScatterDataProxy(itemModel, xPosRole, yPosRole, zPosRole, rotationRole[, parent=None])

PySide6.QtDataVisualization.QItemModelScatterDataProxy([parent=None])

Parameters

Constructs QItemModelScatterDataProxy with itemModel and optional parent. Proxy doesn’t take ownership of the itemModel, as typically item models are owned by other controls.

Constructs QItemModelScatterDataProxy with itemModel and optional parent. Proxy doesn’t take ownership of the itemModel, as typically item models are owned by other controls. The xPosRole property is set to xPosRole, yPosRole property to yPosRole, and zPosRole property to zPosRole.

Constructs QItemModelScatterDataProxy with itemModel and optional parent. Proxy doesn’t take ownership of the itemModel, as typically item models are owned by other controls. The xPosRole property is set to xPosRole, yPosRole property to yPosRole, zPosRole property to zPosRole, and rotationRole property to rotationRole.

Constructs QItemModelScatterDataProxy with optional parent.

PySide6.QtDataVisualization.QItemModelScatterDataProxy.itemModel()
Return type

PySide6.QtCore.QAbstractItemModel

See also

setItemModel()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.itemModelChanged(itemModel)
Parameters

itemModelPySide6.QtCore.QAbstractItemModel

PySide6.QtDataVisualization.QItemModelScatterDataProxy.remap(xPosRole, yPosRole, zPosRole, rotationRole)
Parameters
  • xPosRole – str

  • yPosRole – str

  • zPosRole – str

  • rotationRole – str

Changes xPosRole, yPosRole, zPosRole, and rotationRole mapping.

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRole()
Return type

str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRoleChanged(role)
Parameters

role – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRolePattern()
Return type

PySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRolePatternChanged(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRoleReplace()
Return type

str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.rotationRoleReplaceChanged(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setItemModel(itemModel)
Parameters

itemModelPySide6.QtCore.QAbstractItemModel

Sets itemModel as the item model for Q3DScatter . Does not take ownership of the model, but does connect to it to listen for changes.

See also

itemModel()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setRotationRole(role)
Parameters

role – str

See also

rotationRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setRotationRolePattern(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setRotationRoleReplace(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setXPosRole(role)
Parameters

role – str

See also

xPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setXPosRolePattern(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setXPosRoleReplace(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setYPosRole(role)
Parameters

role – str

See also

yPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setYPosRolePattern(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setYPosRoleReplace(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setZPosRole(role)
Parameters

role – str

See also

zPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setZPosRolePattern(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.setZPosRoleReplace(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRole()
Return type

str

See also

setXPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRoleChanged(role)
Parameters

role – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRolePattern()
Return type

PySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRolePatternChanged(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRoleReplace()
Return type

str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.xPosRoleReplaceChanged(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRole()
Return type

str

See also

setYPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRoleChanged(role)
Parameters

role – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRolePattern()
Return type

PySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRolePatternChanged(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRoleReplace()
Return type

str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.yPosRoleReplaceChanged(replace)
Parameters

replace – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRole()
Return type

str

See also

setZPosRole()

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRoleChanged(role)
Parameters

role – str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRolePattern()
Return type

PySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRolePatternChanged(pattern)
Parameters

patternPySide6.QtCore.QRegularExpression

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRoleReplace()
Return type

str

PySide6.QtDataVisualization.QItemModelScatterDataProxy.zPosRoleReplaceChanged(replace)
Parameters

replace – str