diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-07-11 09:59:57 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-18 02:15:40 +0200 |
commit | a72d15c8a7ca8b89b2160f4e48af5cf69e2a31e7 (patch) | |
tree | dd1b0ec088e23556b0a6b9b80130d35b48c8c0ec /src/sensors | |
parent | 5464963f9afae3bf7329d9b0ea7102231125f794 (diff) |
Introduce QRotationReading::setFromEuler() in favor of set{X/Y/Z}()
In preparation of adding new representations to the reading (QTBUG-25840),
the setX(), setY() and setZ() setters were removed, as these don't set
the representation atomically, and don't provide a single point where
a conversion to matrix or quaternion can occur. These setters were
only supposed to be used by the backends, and all backends are
ported in this commit.
Change-Id: Ib652520578d293687fc8515d226f1f61aa2f2def
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
Diffstat (limited to 'src/sensors')
-rw-r--r-- | src/sensors/qrotationsensor.cpp | 31 | ||||
-rw-r--r-- | src/sensors/qrotationsensor.h | 7 |
2 files changed, 14 insertions, 24 deletions
diff --git a/src/sensors/qrotationsensor.cpp b/src/sensors/qrotationsensor.cpp index 6adbf6a2..120723c7 100644 --- a/src/sensors/qrotationsensor.cpp +++ b/src/sensors/qrotationsensor.cpp @@ -116,14 +116,6 @@ qreal QRotationReading::x() const } /*! - Sets the rotation around the x axis to \a x. -*/ -void QRotationReading::setX(qreal x) -{ - d->x = x; -} - -/*! \property QRotationReading::y \brief the rotation around the y axis. @@ -137,14 +129,6 @@ qreal QRotationReading::y() const } /*! - Sets the rotation around the y axis to \a y. -*/ -void QRotationReading::setY(qreal y) -{ - d->y = y; -} - -/*! \property QRotationReading::z \brief the rotation around the z axis. @@ -158,10 +142,19 @@ qreal QRotationReading::z() const } /*! - Sets the rotation around the z axis to \a z. -*/ -void QRotationReading::setZ(qreal z) + \brief Sets the rotation from three euler angles. + + This is to be called from the backend. + + The angles are measured in degrees. The order of the rotations matters, as first the \a z rotation + is applied, then the \a x rotation and finally the \a y rotation. + + \since 5.0 + */ +void QRotationReading::setFromEuler(qreal x, qreal y, qreal z) { + d->x = x; + d->y = y; d->z = z; } diff --git a/src/sensors/qrotationsensor.h b/src/sensors/qrotationsensor.h index 9e022803..7021f355 100644 --- a/src/sensors/qrotationsensor.h +++ b/src/sensors/qrotationsensor.h @@ -60,13 +60,10 @@ class Q_SENSORS_EXPORT QRotationReading : public QSensorReading DECLARE_READING(QRotationReading) public: qreal x() const; - void setX(qreal x); - qreal y() const; - void setY(qreal y); - qreal z() const; - void setZ(qreal z); + + void setFromEuler(qreal x, qreal y, qreal z); }; class Q_SENSORS_EXPORT QRotationFilter : public QSensorFilter |