PySide6.QtGraphs.QItemModelScatterDataProxy¶
- class QItemModelScatterDataProxy¶
Proxy class for presenting data in item models with
Q3DScatterWidgetItem
. More…Synopsis¶
Properties¶
itemModelᅟ
- Item model to use as a data source for a 3D scatter seriesrotationRoleᅟ
- Item model role to map into item rotationrotationRolePatternᅟ
- Whether a search and replace is done on the value mapped by the rotation role before it is used as item rotationrotationRoleReplaceᅟ
- Replace content to be used in conjunction with the rotation role patternxPosRoleᅟ
- Item model role to map into the X positionxPosRolePatternᅟ
- Whether search and replace is done on the value mapped by the x position role before it is used as an item position valuexPosRoleReplaceᅟ
- Replace content to be used in conjunction with the x position role patternyPosRoleᅟ
- Item model role to map into the Y positionyPosRolePatternᅟ
- Whether a search and replace is done on the value mapped by the y position role before it is used as an item position valueyPosRoleReplaceᅟ
- Replace content to be used in conjunction with the y position role patternzPosRoleᅟ
- Item model role to map into the Z positionzPosRolePatternᅟ
- Whether a search and replace is done on the value mapped by the z position role before it is used as an item position valuezPosRoleReplaceᅟ
- Replace content to be used in conjunction with the z position role pattern
Methods¶
def
__init__()
def
itemModel()
def
remap()
def
rotationRole()
def
setItemModel()
def
setXPosRole()
def
setYPosRole()
def
setZPosRole()
def
xPosRole()
def
yPosRole()
def
zPosRole()
Signals¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
QItemModelScatterDataProxy
allows you to use QAbstractItemModel derived models as a data source forQ3DScatterWidgetItem
. It maps roles of QAbstractItemModel to the XYZ-values ofQ3DScatterWidgetItem
points.The data is resolved asynchronously whenever the mapping or the model changes.
arrayReset()
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. proxy = QItemModelScatterDataProxy(customModel,() "density", "hardness", "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 on how the replacement using regular expressions works, see the QString::replace(const QRegularExpression &rx, const QString &after) function documentation. Note that using regular expressions has an impact on 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 Simple Bar Graph .
See also
Qt Graphs Data Handling with 3D
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property itemModelᅟ: QAbstractItemModel¶
This property holds The item model to use as a data source for a 3D scatter series..
- Access functions:
- property rotationRoleᅟ: str¶
This property holds The item model role to map into item rotation..
The model may supply the value for rotation as either a variant that is directly convertible to QQuaternion or as one of the string representations:
"scalar,x,y,z"
or"@angle,x,y,z"
. The first will construct the quaternion directly with the given values, and the second one will construct the quaternion using the QQuaternion::fromAxisAndAngle() method.- Access functions:
- property rotationRolePatternᅟ: QRegularExpression¶
This property holds Whether a search and replace is done on the value mapped by the rotation role before it is used as item rotation..
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
- Access functions:
- property rotationRoleReplaceᅟ: str¶
This property holds The replace content to be used in conjunction with the rotation role pattern..
Defaults to an 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
- Access functions:
- property xPosRoleᅟ: str¶
This property holds The item model role to map into the X position..
- Access functions:
- property xPosRolePatternᅟ: QRegularExpression¶
This property holds Whether search and replace is done on the value mapped by the x position role before it is used as an item position value..
This property specifies the regular expression to find the portion of the mapped value to replace and
xPosRoleReplace
property contains the replacement string.See also
- Access functions:
- property xPosRoleReplaceᅟ: str¶
This property holds The replace content to be used in conjunction with the x position role pattern..
Defaults to an 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
- Access functions:
- property yPosRoleᅟ: str¶
This property holds The item model role to map into the Y position..
- Access functions:
- property yPosRolePatternᅟ: QRegularExpression¶
This property holds Whether a search and replace is done on the value mapped by the y position role before it is used as an item position value..
This property specifies the regular expression to find the portion of the mapped value to replace and
yPosRoleReplace
property contains the replacement string.See also
- Access functions:
- property yPosRoleReplaceᅟ: str¶
This property holds The replace content to be used in conjunction with the y position role pattern..
Defaults to an 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
- Access functions:
- property zPosRoleᅟ: str¶
This property holds The item model role to map into the Z position..
- Access functions:
- property zPosRolePatternᅟ: QRegularExpression¶
This property holds Whether a search and replace is done on the value mapped by the z position role before it is used as an item position value..
This property specifies the regular expression to find the portion of the mapped value to replace and
zPosRoleReplace
property contains the replacement string.See also
- Access functions:
- property zPosRoleReplaceᅟ: str¶
This property holds The replace content to be used in conjunction with the z position role pattern..
Defaults to an 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
- Access functions:
Constructs
QItemModelScatterDataProxy
with optionalparent
.- __init__(itemModel[, parent=None])
- Parameters:
itemModel –
QAbstractItemModel
parent –
QObject
Constructs
QItemModelScatterDataProxy
withitemModel
and an optionalparent
. Proxy doesn’t take ownership of theitemModel
, as typically item models are owned by other controls.- __init__(itemModel, xPosRole, yPosRole, zPosRole[, parent=None])
- Parameters:
itemModel –
QAbstractItemModel
xPosRole – str
yPosRole – str
zPosRole – str
parent –
QObject
Constructs
QItemModelScatterDataProxy
withitemModel
and an optionalparent
. The proxy doesn’t take ownership of theitemModel
, as item models are typically owned by other controls. ThexPosRole
property is set toxPosRole
, theyPosRole
property toyPosRole
, and thezPosRole
property tozPosRole
.- __init__(itemModel, xPosRole, yPosRole, zPosRole, rotationRole[, parent=None])
- Parameters:
itemModel –
QAbstractItemModel
xPosRole – str
yPosRole – str
zPosRole – str
rotationRole – str
parent –
QObject
Constructs
QItemModelScatterDataProxy
withitemModel
and an optionalparent
. The proxy doesn’t take ownership of theitemModel
, as item models are typically owned by other controls. ThexPosRole
property is set toxPosRole
, theyPosRole
property toyPosRole
, thezPosRole
property tozPosRole
, and therotationRole
property torotationRole
.- itemModel()¶
- Return type:
See also
Getter of property
itemModelᅟ
.- itemModelChanged(itemModel)¶
- Parameters:
itemModel –
QAbstractItemModel
Notification signal of property
itemModelᅟ
.- remap(xPosRole, yPosRole, zPosRole, rotationRole)¶
- Parameters:
xPosRole – str
yPosRole – str
zPosRole – str
rotationRole – str
Changes
xPosRole
,yPosRole
,zPosRole
, androtationRole
mapping.- rotationRole()¶
- Return type:
str
See also
Getter of property
rotationRoleᅟ
.- rotationRoleChanged(role)¶
- Parameters:
role – str
Notification signal of property
rotationRoleᅟ
.- rotationRolePattern()¶
- Return type:
See also
Getter of property
rotationRolePatternᅟ
.- rotationRolePatternChanged(pattern)¶
- Parameters:
pattern –
QRegularExpression
Notification signal of property
rotationRolePatternᅟ
.- rotationRoleReplace()¶
- Return type:
str
See also
Getter of property
rotationRoleReplaceᅟ
.- rotationRoleReplaceChanged(replace)¶
- Parameters:
replace – str
Notification signal of property
rotationRoleReplaceᅟ
.- setItemModel(itemModel)¶
- Parameters:
itemModel –
QAbstractItemModel
Sets
itemModel
as the item model forQ3DScatterWidgetItem
. Does not take ownership of the model, but does connect to it to listen for changes.See also
Setter of property
itemModelᅟ
.- setRotationRole(role)¶
- Parameters:
role – str
See also
Setter of property
rotationRoleᅟ
.- setRotationRolePattern(pattern)¶
- Parameters:
pattern –
QRegularExpression
See also
Setter of property
rotationRolePatternᅟ
.- setRotationRoleReplace(replace)¶
- Parameters:
replace – str
See also
Setter of property
rotationRoleReplaceᅟ
.- setXPosRole(role)¶
- Parameters:
role – str
See also
Setter of property
xPosRoleᅟ
.- setXPosRolePattern(pattern)¶
- Parameters:
pattern –
QRegularExpression
See also
Setter of property
xPosRolePatternᅟ
.- setXPosRoleReplace(replace)¶
- Parameters:
replace – str
See also
Setter of property
xPosRoleReplaceᅟ
.- setYPosRole(role)¶
- Parameters:
role – str
See also
Setter of property
yPosRoleᅟ
.- setYPosRolePattern(pattern)¶
- Parameters:
pattern –
QRegularExpression
See also
Setter of property
yPosRolePatternᅟ
.- setYPosRoleReplace(replace)¶
- Parameters:
replace – str
See also
Setter of property
yPosRoleReplaceᅟ
.- setZPosRole(role)¶
- Parameters:
role – str
See also
Setter of property
zPosRoleᅟ
.- setZPosRolePattern(pattern)¶
- Parameters:
pattern –
QRegularExpression
See also
Setter of property
zPosRolePatternᅟ
.- setZPosRoleReplace(replace)¶
- Parameters:
replace – str
See also
Setter of property
zPosRoleReplaceᅟ
.- xPosRole()¶
- Return type:
str
See also
Getter of property
xPosRoleᅟ
.- xPosRoleChanged(role)¶
- Parameters:
role – str
Notification signal of property
xPosRoleᅟ
.- xPosRolePattern()¶
- Return type:
See also
Getter of property
xPosRolePatternᅟ
.- xPosRolePatternChanged(pattern)¶
- Parameters:
pattern –
QRegularExpression
Notification signal of property
xPosRolePatternᅟ
.- xPosRoleReplace()¶
- Return type:
str
See also
Getter of property
xPosRoleReplaceᅟ
.- xPosRoleReplaceChanged(replace)¶
- Parameters:
replace – str
Notification signal of property
xPosRoleReplaceᅟ
.- yPosRole()¶
- Return type:
str
See also
Getter of property
yPosRoleᅟ
.- yPosRoleChanged(role)¶
- Parameters:
role – str
Notification signal of property
yPosRoleᅟ
.- yPosRolePattern()¶
- Return type:
See also
Getter of property
yPosRolePatternᅟ
.- yPosRolePatternChanged(pattern)¶
- Parameters:
pattern –
QRegularExpression
Notification signal of property
yPosRolePatternᅟ
.- yPosRoleReplace()¶
- Return type:
str
See also
Getter of property
yPosRoleReplaceᅟ
.- yPosRoleReplaceChanged(replace)¶
- Parameters:
replace – str
Notification signal of property
yPosRoleReplaceᅟ
.- zPosRole()¶
- Return type:
str
See also
Getter of property
zPosRoleᅟ
.- zPosRoleChanged(role)¶
- Parameters:
role – str
Notification signal of property
zPosRoleᅟ
.- zPosRolePattern()¶
- Return type:
See also
Getter of property
zPosRolePatternᅟ
.- zPosRolePatternChanged(pattern)¶
- Parameters:
pattern –
QRegularExpression
Notification signal of property
zPosRolePatternᅟ
.- zPosRoleReplace()¶
- Return type:
str
See also
Getter of property
zPosRoleReplaceᅟ
.- zPosRoleReplaceChanged(replace)¶
- Parameters:
replace – str
Notification signal of property
zPosRoleReplaceᅟ
.