QItemModelScatterDataProxy Class
Proxy class for presenting data in item models with Q3DScatter. More...
Header: | #include <QItemModelScatterDataProxy> |
Since: | QtDataVisualization 1.0 |
Instantiated By: | ItemModelScatterDataProxy |
Inherits: | QScatterDataProxy |
Properties
|
|
- 2 properties inherited from QScatterDataProxy
- 1 property inherited from QAbstractDataProxy
- 1 property inherited from QObject
Public Functions
QItemModelScatterDataProxy(QObject *parent = Q_NULLPTR) | |
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = Q_NULLPTR) | |
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, QObject *parent = Q_NULLPTR) | |
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole, QObject *parent = Q_NULLPTR) | |
virtual | ~QItemModelScatterDataProxy() |
QAbstractItemModel * | itemModel() const |
void | remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole) |
QString | rotationRole() const |
QRegExp | rotationRolePattern() const |
QString | rotationRoleReplace() const |
void | setItemModel(QAbstractItemModel *itemModel) |
void | setRotationRole(const QString &role) |
void | setRotationRolePattern(const QRegExp &pattern) |
void | setRotationRoleReplace(const QString &replace) |
void | setXPosRole(const QString &role) |
void | setXPosRolePattern(const QRegExp &pattern) |
void | setXPosRoleReplace(const QString &replace) |
void | setYPosRole(const QString &role) |
void | setYPosRolePattern(const QRegExp &pattern) |
void | setYPosRoleReplace(const QString &replace) |
void | setZPosRole(const QString &role) |
void | setZPosRolePattern(const QRegExp &pattern) |
void | setZPosRoleReplace(const QString &replace) |
QString | xPosRole() const |
QRegExp | xPosRolePattern() const |
QString | xPosRoleReplace() const |
QString | yPosRole() const |
QRegExp | yPosRolePattern() const |
QString | yPosRoleReplace() const |
QString | zPosRole() const |
QRegExp | zPosRolePattern() const |
QString | zPosRoleReplace() const |
- 12 public functions inherited from QScatterDataProxy
- 1 public function inherited from QAbstractDataProxy
- 31 public functions inherited from QObject
Signals
void | itemModelChanged(const QAbstractItemModel *itemModel) |
void | rotationRoleChanged(const QString &role) |
void | rotationRolePatternChanged(const QRegExp &pattern) |
void | rotationRoleReplaceChanged(const QString &replace) |
void | xPosRoleChanged(const QString &role) |
void | xPosRolePatternChanged(const QRegExp &pattern) |
void | xPosRoleReplaceChanged(const QString &replace) |
void | yPosRoleChanged(const QString &role) |
void | yPosRolePatternChanged(const QRegExp &pattern) |
void | yPosRoleReplaceChanged(const QString &replace) |
void | zPosRoleChanged(const QString &role) |
void | zPosRolePatternChanged(const QRegExp &pattern) |
void | zPosRoleReplaceChanged(const QString &replace) |
- 7 signals inherited from QScatterDataProxy
- 2 signals inherited from QObject
Additional Inherited Members
- 1 public slot inherited from QObject
- 11 static public members inherited from QObject
- 9 protected functions inherited from QObject
Detailed Description
Proxy class for presenting data in item models with Q3DScatter.
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. QScatterDataProxy::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. 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 QString::replace(const QRegExp &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.
See also Qt Data Visualization Data Handling.
Property Documentation
itemModel : QAbstractItemModel *
Defines the item model. Does not take ownership of the model, but does connect to it to listen for changes.
Access functions:
QAbstractItemModel * | itemModel() const |
void | setItemModel(QAbstractItemModel *itemModel) |
Notifier signal:
void | itemModelChanged(const QAbstractItemModel *itemModel) |
rotationRole : QString
Defines the item model role to map into item rotation.
The model may supply the value for rotation as either 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 given values, and the second one will construct the quaternion using QQuaternion::fromAxisAndAngle() method.
Access functions:
QString | rotationRole() const |
void | setRotationRole(const QString &role) |
Notifier signal:
void | rotationRoleChanged(const QString &role) |
rotationRolePattern : QRegExp
When set, a search and replace is done on the value mapped by rotation role before it is used as a 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.
Access functions:
QRegExp | rotationRolePattern() const |
void | setRotationRolePattern(const QRegExp &pattern) |
Notifier signal:
void | rotationRolePatternChanged(const QRegExp &pattern) |
See also rotationRole and rotationRoleReplace.
rotationRoleReplace : QString
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 QRegExp &rx, const QString &after) function documentation.
Access functions:
QString | rotationRoleReplace() const |
void | setRotationRoleReplace(const QString &replace) |
Notifier signal:
void | rotationRoleReplaceChanged(const QString &replace) |
See also rotationRole and rotationRolePattern.
xPosRole : QString
Defines the item model role to map into X position.
Access functions:
QString | xPosRole() const |
void | setXPosRole(const QString &role) |
Notifier signal:
void | xPosRoleChanged(const QString &role) |
xPosRolePattern : QRegExp
When set, a search and replace is done on the value mapped by xPos role before it is used as a 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.
Access functions:
QRegExp | xPosRolePattern() const |
void | setXPosRolePattern(const QRegExp &pattern) |
Notifier signal:
void | xPosRolePatternChanged(const QRegExp &pattern) |
See also xPosRole and xPosRoleReplace.
xPosRoleReplace : QString
This property defines the replace content to be used in conjunction with xPosRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegExp &rx, const QString &after) function documentation.
Access functions:
QString | xPosRoleReplace() const |
void | setXPosRoleReplace(const QString &replace) |
Notifier signal:
void | xPosRoleReplaceChanged(const QString &replace) |
See also xPosRole and xPosRolePattern.
yPosRole : QString
Defines the item model role to map into Y position.
Access functions:
QString | yPosRole() const |
void | setYPosRole(const QString &role) |
Notifier signal:
void | yPosRoleChanged(const QString &role) |
yPosRolePattern : QRegExp
When set, a search and replace is done on the value mapped by yPos role before it is used as a 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.
Access functions:
QRegExp | yPosRolePattern() const |
void | setYPosRolePattern(const QRegExp &pattern) |
Notifier signal:
void | yPosRolePatternChanged(const QRegExp &pattern) |
See also yPosRole and yPosRoleReplace.
yPosRoleReplace : QString
This property defines the replace content to be used in conjunction with yPosRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegExp &rx, const QString &after) function documentation.
Access functions:
QString | yPosRoleReplace() const |
void | setYPosRoleReplace(const QString &replace) |
Notifier signal:
void | yPosRoleReplaceChanged(const QString &replace) |
See also yPosRole and yPosRolePattern.
zPosRole : QString
Defines the item model role to map into Z position.
Access functions:
QString | zPosRole() const |
void | setZPosRole(const QString &role) |
Notifier signal:
void | zPosRoleChanged(const QString &role) |
zPosRolePattern : QRegExp
When set, a search and replace is done on the value mapped by zPos role before it is used as a 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.
Access functions:
QRegExp | zPosRolePattern() const |
void | setZPosRolePattern(const QRegExp &pattern) |
Notifier signal:
void | zPosRolePatternChanged(const QRegExp &pattern) |
See also zPosRole and zPosRoleReplace.
zPosRoleReplace : QString
This property defines the replace content to be used in conjunction with zPosRolePattern. Defaults to empty string. For more information on how the search and replace using regular expressions works, see QString::replace(const QRegExp &rx, const QString &after) function documentation.
Access functions:
QString | zPosRoleReplace() const |
void | setZPosRoleReplace(const QString &replace) |
Notifier signal:
void | zPosRoleReplaceChanged(const QString &replace) |
See also zPosRole and zPosRolePattern.
Member Function Documentation
QItemModelScatterDataProxy::QItemModelScatterDataProxy(QObject *parent = Q_NULLPTR)
Constructs QItemModelScatterDataProxy with optional parent.
QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = Q_NULLPTR)
Constructs QItemModelScatterDataProxy with itemModel and optional parent. Proxy doesn't take ownership of the itemModel, as typically item models are owned by other controls.
QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, QObject *parent = Q_NULLPTR)
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.
QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole, QObject *parent = Q_NULLPTR)
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.
[virtual]
QItemModelScatterDataProxy::~QItemModelScatterDataProxy()
Destroys QItemModelScatterDataProxy.
void QItemModelScatterDataProxy::remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole)
Changes xPosRole, yPosRole, zPosRole, and rotationRole mapping.
© 2017 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.