diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2016-05-19 11:31:04 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-23 11:57:45 +0000 |
commit | 8974dd346cb229a9bb2d9f36396759e300bc5980 (patch) | |
tree | acef8b304aeaabeb0e5d8fb3be7a86ade93d9807 /src | |
parent | 6682a119b4fad6edc0f1b4b0e1613227ff916bae (diff) |
Use QVector instead of QVariantList properties
Change-Id: I183bac3fb423d068df4f65ae96a7706f83cfa20f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/input/backend/axissetting.cpp | 17 | ||||
-rw-r--r-- | src/input/frontend/qaxissetting.cpp | 4 | ||||
-rw-r--r-- | src/input/frontend/qaxissetting.h | 8 | ||||
-rw-r--r-- | src/input/frontend/qaxissetting_p.h | 5 | ||||
-rw-r--r-- | src/quick3d/imports/input/plugins.qmltypes | 6 |
5 files changed, 13 insertions, 27 deletions
diff --git a/src/input/backend/axissetting.cpp b/src/input/backend/axissetting.cpp index c915e018c..10892f861 100644 --- a/src/input/backend/axissetting.cpp +++ b/src/input/backend/axissetting.cpp @@ -44,19 +44,6 @@ QT_BEGIN_NAMESPACE -namespace { - -QVector<int> variantListToVector(const QVariantList &list) -{ - QVector<int> v(list.size()); - int i = 0; - for (const QVariant &e : list) - v[i++] = e.toInt(); - return v; -} - -} - namespace Qt3DInput { namespace Input { @@ -73,7 +60,7 @@ void AxisSetting::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr & const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAxisSettingData>>(change); const auto &data = typedChange->data; m_deadZoneRadius = data.deadZoneRadius; - m_axes = variantListToVector(data.axes); + m_axes = data.axes; m_smooth = data.smooth; } @@ -92,7 +79,7 @@ void AxisSetting::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) if (propertyChange->propertyName() == QByteArrayLiteral("deadZoneRadius")) { m_deadZoneRadius = propertyChange->value().toFloat(); } else if (propertyChange->propertyName() == QByteArrayLiteral("axes")) { - m_axes = variantListToVector(propertyChange->value().toList()); + m_axes = propertyChange->value().value<QVector<int>>(); } else if (propertyChange->propertyName() == QByteArrayLiteral("smooth")) { m_smooth = propertyChange->value().toBool(); } diff --git a/src/input/frontend/qaxissetting.cpp b/src/input/frontend/qaxissetting.cpp index bd21097ef..083203d2a 100644 --- a/src/input/frontend/qaxissetting.cpp +++ b/src/input/frontend/qaxissetting.cpp @@ -72,7 +72,7 @@ QAxisSetting::~QAxisSetting() { } -QVariantList QAxisSetting::axes() const +QVector<int> QAxisSetting::axes() const { Q_D(const QAxisSetting); return d->m_axes; @@ -100,7 +100,7 @@ void QAxisSetting::setDeadZoneRadius(float deadZoneRadius) emit deadZoneRadiusChanged(deadZoneRadius); } -void QAxisSetting::setAxes(const QVariantList &axes) +void QAxisSetting::setAxes(const QVector<int> &axes) { Q_D(QAxisSetting); if (d->m_axes == axes) diff --git a/src/input/frontend/qaxissetting.h b/src/input/frontend/qaxissetting.h index 6298dcb40..483c6c2a0 100644 --- a/src/input/frontend/qaxissetting.h +++ b/src/input/frontend/qaxissetting.h @@ -55,7 +55,7 @@ class QT3DINPUTSHARED_EXPORT QAxisSetting : public Qt3DCore::QNode { Q_OBJECT Q_PROPERTY(float deadZoneRadius READ deadZoneRadius WRITE setDeadZoneRadius NOTIFY deadZoneRadiusChanged) - Q_PROPERTY(QVariantList axes READ axes WRITE setAxes NOTIFY axesChanged) + Q_PROPERTY(QVector<int> axes READ axes WRITE setAxes NOTIFY axesChanged) Q_PROPERTY(bool smooth READ isSmoothEnabled WRITE setSmoothEnabled NOTIFY smoothChanged) public: @@ -63,17 +63,17 @@ public: ~QAxisSetting(); float deadZoneRadius() const; - QVariantList axes() const; + QVector<int> axes() const; bool isSmoothEnabled() const; public Q_SLOTS: void setDeadZoneRadius(float deadZoneRadius); - void setAxes(const QVariantList &axes); + void setAxes(const QVector<int> &axes); void setSmoothEnabled(bool enabled); Q_SIGNALS: void deadZoneRadiusChanged(float deadZoneRadius); - void axesChanged(QVariantList axes); + void axesChanged(const QVector<int> &axes); void smoothChanged(bool smooth); private: diff --git a/src/input/frontend/qaxissetting_p.h b/src/input/frontend/qaxissetting_p.h index e7d841f60..b3d162e8f 100644 --- a/src/input/frontend/qaxissetting_p.h +++ b/src/input/frontend/qaxissetting_p.h @@ -52,7 +52,6 @@ // #include <Qt3DCore/private/qnode_p.h> -#include <QtCore/qvariant.h> QT_BEGIN_NAMESPACE @@ -69,14 +68,14 @@ public: {} float m_deadZoneRadius; - QVariantList m_axes; + QVector<int> m_axes; bool m_smooth; }; struct QAxisSettingData { float deadZoneRadius; - QVariantList axes; + QVector<int> axes; bool smooth; }; diff --git a/src/quick3d/imports/input/plugins.qmltypes b/src/quick3d/imports/input/plugins.qmltypes index faa8ea944..4dcc66160 100644 --- a/src/quick3d/imports/input/plugins.qmltypes +++ b/src/quick3d/imports/input/plugins.qmltypes @@ -191,7 +191,7 @@ Module { exports: ["Qt3D.Input/AxisSetting 2.0"] exportMetaObjectRevisions: [0] Property { name: "deadZoneRadius"; type: "float" } - Property { name: "axes"; type: "QVariantList" } + Property { name: "axes"; type: "QVector<int>" } Property { name: "smooth"; type: "bool" } Signal { name: "deadZoneRadiusChanged" @@ -199,7 +199,7 @@ Module { } Signal { name: "axesChanged" - Parameter { name: "axes"; type: "QVariantList" } + Parameter { name: "axes"; type: "QVector<int>" } } Signal { name: "smoothChanged" @@ -211,7 +211,7 @@ Module { } Method { name: "setAxes" - Parameter { name: "axes"; type: "QVariantList" } + Parameter { name: "axes"; type: "QVector<int>" } } Method { name: "setSmoothEnabled" |