diff options
author | Janne Kangas <janne.kangas@qt.io> | 2019-05-14 11:02:30 +0300 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2019-06-11 11:19:32 +0300 |
commit | 24bdd648eb1724b50594408de4bfbf1f73a755d1 (patch) | |
tree | 215583d3bc369b3bac82819589cc62522789a27e | |
parent | e366719a6ca814d3a1706e7ad731ff6655f4f59d (diff) |
Make datainput metadata keys constant Q_PROPERTY
Remove invokable datainputKeys and make it a datainput property instead.
In OpenGL RT this is a constant property as metadata is read-only property.
Also update qmldatainput example.
Change-Id: Ic9037f831b4072481ad5b2fac78ecc68db6808b2
Task-id: QT3DS-3625
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | examples/studio3d/qmldatainput/qml/qmldatainput/main.qml | 10 | ||||
-rw-r--r-- | src/api/studio3d/q3dsdatainput.cpp | 15 | ||||
-rw-r--r-- | src/api/studio3d/q3dsdatainput.h | 3 |
3 files changed, 15 insertions, 13 deletions
diff --git a/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml b/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml index ab50796..7d55f73 100644 --- a/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml +++ b/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml @@ -94,7 +94,7 @@ Item { + (modelData.max !== 0 ? "\n range min: " + modelData.min + "\n range max: " + modelData.max : "") - + " \n metadata keys: [" + modelData.metadataKeys() + "]" + + " \n metadata keys: [" + modelData.metadataKeys + "]" font.pointSize: 6 } } @@ -113,10 +113,6 @@ Item { property string inputString: "" property variant inputVariant: 0 - onPresentationLoaded: { - diList.updateModel(); - } - // A changing property to demonstrate DataInput NumberAnimation { target: studio3D @@ -179,6 +175,10 @@ Item { id: presentation source: "qrc:/presentation/datainput.uia" + + onDataInputsReady: { + diList.updateModel(); + } DataInput { // Name must match the data input name specified in the presentation name: "rangeInput" diff --git a/src/api/studio3d/q3dsdatainput.cpp b/src/api/studio3d/q3dsdatainput.cpp index a15f9fb..45134d8 100644 --- a/src/api/studio3d/q3dsdatainput.cpp +++ b/src/api/studio3d/q3dsdatainput.cpp @@ -290,13 +290,6 @@ QString Q3DSDataInput::metadata(const QString &key) const \sa metadata */ -/*! - \qmlmethod var DataInput::metadataKeys - Returns the metadata keys defined for this datainput. - - \note Datainput metadata is read-only. - \sa metadata - */ QStringList Q3DSDataInput::metadataKeys() const { if (!d_ptr->m_presentation) @@ -448,4 +441,12 @@ void Q3DSDataInputPrivate::setCommandQueue(CommandQueue *queue) \note This value is read-only. */ +/*! + \qmlproperty list<string> DataInput::metadataKeys + + Contains the metadata keys specified for this datainput. + + \note This value is read-only. +*/ + QT_END_NAMESPACE diff --git a/src/api/studio3d/q3dsdatainput.h b/src/api/studio3d/q3dsdatainput.h index 3617dcd..3f81c65 100644 --- a/src/api/studio3d/q3dsdatainput.h +++ b/src/api/studio3d/q3dsdatainput.h @@ -48,6 +48,7 @@ class Q_STUDIO3D_EXPORT Q3DSDataInput : public QObject Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(float max READ max CONSTANT) Q_PROPERTY(float min READ min CONSTANT) + Q_PROPERTY(QStringList metadataKeys READ metadataKeys CONSTANT) public: explicit Q3DSDataInput(QObject *parent = nullptr); explicit Q3DSDataInput(const QString &name, QObject *parent = nullptr); @@ -69,7 +70,7 @@ public: bool isValid() const; Q_INVOKABLE QString metadata(const QString &key) const; - Q_INVOKABLE QStringList metadataKeys() const; + QStringList metadataKeys() const; public Q_SLOTS: void setName(const QString &name); |