Proxy class for presenting data in item models with Q3DScatter . 更多...
头: | #include <QItemModelScatterDataProxy> |
Since: | QtDataVisualization 1.0 |
实例化: | ItemModelScatterDataProxy |
继承: | QScatterDataProxy |
|
|
QItemModelScatterDataProxy (QObject * parent = nullptr) | |
QItemModelScatterDataProxy (QAbstractItemModel * itemModel , QObject * parent = nullptr) | |
QItemModelScatterDataProxy (QAbstractItemModel * itemModel , const QString & xPosRole , const QString & yPosRole , const QString & zPosRole , QObject * parent = nullptr) | |
QItemModelScatterDataProxy (QAbstractItemModel * itemModel , const QString & xPosRole , const QString & yPosRole , const QString & zPosRole , const QString & rotationRole , QObject * parent = 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 |
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 ) |
const QMetaObject | staticMetaObject |
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 .
另请参阅 Qt Data Visualization 数据处理 .
This property holds the item model to use as a data source for a 3D scatter series.
访问函数:
QAbstractItemModel * | itemModel () const |
void | setItemModel (QAbstractItemModel * itemModel ) |
通知程序信号:
void | itemModelChanged (const QAbstractItemModel * itemModel ) |
This property holds 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
() 方法。
访问函数:
QString | rotationRole () const |
void | setRotationRole (const QString & role ) |
通知程序信号:
void | rotationRoleChanged (const QString & role ) |
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.
访问函数:
QRegExp | rotationRolePattern () const |
void | setRotationRolePattern (const QRegExp & pattern ) |
通知程序信号:
void | rotationRolePatternChanged (const QRegExp & pattern ) |
另请参阅 rotationRole and rotationRoleReplace .
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 QRegExp &rx, const QString &after) function documentation.
访问函数:
QString | rotationRoleReplace () const |
void | setRotationRoleReplace (const QString & replace ) |
通知程序信号:
void | rotationRoleReplaceChanged (const QString & replace ) |
另请参阅 rotationRole and rotationRolePattern .
This property holds the item model role to map into the X position.
访问函数:
QString | xPosRole () const |
void | setXPosRole (const QString & role ) |
通知程序信号:
void | xPosRoleChanged (const QString & role ) |
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.
访问函数:
QRegExp | xPosRolePattern () const |
void | setXPosRolePattern (const QRegExp & pattern ) |
通知程序信号:
void | xPosRolePatternChanged (const QRegExp & pattern ) |
另请参阅 xPosRole and xPosRoleReplace .
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 QRegExp &rx, const QString &after) function documentation.
访问函数:
QString | xPosRoleReplace () const |
void | setXPosRoleReplace (const QString & replace ) |
通知程序信号:
void | xPosRoleReplaceChanged (const QString & replace ) |
另请参阅 xPosRole and xPosRolePattern .
This property holds the item model role to map into the Y position.
访问函数:
QString | yPosRole () const |
void | setYPosRole (const QString & role ) |
通知程序信号:
void | yPosRoleChanged (const QString & role ) |
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.
访问函数:
QRegExp | yPosRolePattern () const |
void | setYPosRolePattern (const QRegExp & pattern ) |
通知程序信号:
void | yPosRolePatternChanged (const QRegExp & pattern ) |
另请参阅 yPosRole and yPosRoleReplace .
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 QRegExp &rx, const QString &after) function documentation.
访问函数:
QString | yPosRoleReplace () const |
void | setYPosRoleReplace (const QString & replace ) |
通知程序信号:
void | yPosRoleReplaceChanged (const QString & replace ) |
另请参阅 yPosRole and yPosRolePattern .
This property holds the item model role to map into the Z position.
访问函数:
QString | zPosRole () const |
void | setZPosRole (const QString & role ) |
通知程序信号:
void | zPosRoleChanged (const QString & role ) |
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.
访问函数:
QRegExp | zPosRolePattern () const |
void | setZPosRolePattern (const QRegExp & pattern ) |
通知程序信号:
void | zPosRolePatternChanged (const QRegExp & pattern ) |
另请参阅 zPosRole and zPosRoleReplace .
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 QRegExp &rx, const QString &after) function documentation.
访问函数:
QString | zPosRoleReplace () const |
void | setZPosRoleReplace (const QString & replace ) |
通知程序信号:
void | zPosRoleReplaceChanged (const QString & replace ) |
另请参阅 zPosRole and zPosRolePattern .
Constructs QItemModelScatterDataProxy with optional parent .
Constructs QItemModelScatterDataProxy with itemModel 和可选 parent . Proxy doesn't take ownership of the itemModel , as typically item models are owned by other controls.
Constructs QItemModelScatterDataProxy with itemModel 和可选 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 特性到 yPosRole ,和 zPosRole 特性到 zPosRole .
Constructs QItemModelScatterDataProxy with itemModel 和可选 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 特性到 yPosRole , zPosRole 特性到 zPosRole ,和 rotationRole 特性到 rotationRole .
[虚拟]
QItemModelScatterDataProxy::
~QItemModelScatterDataProxy
()
销毁 QItemModelScatterDataProxy .
变化 xPosRole , yPosRole , zPosRole ,和 rotationRole mapping.
集 itemModel as the item model for Q3DScatter . Does not take ownership of the model, but does connect to it to listen for changes.
注意: setter 函数对于特性 itemModel .
另请参阅 itemModel ().