From a72d15c8a7ca8b89b2160f4e48af5cf69e2a31e7 Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Wed, 11 Jul 2012 09:59:57 +0200 Subject: 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 Reviewed-by: Lorn Potter --- src/plugins/sensors/blackberry/bbrotationsensor.cpp | 6 +++--- src/plugins/sensors/generic/genericrotationsensor.cpp | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/sensors/blackberry/bbrotationsensor.cpp b/src/plugins/sensors/blackberry/bbrotationsensor.cpp index 28dc49c9..e6d038d2 100644 --- a/src/plugins/sensors/blackberry/bbrotationsensor.cpp +++ b/src/plugins/sensors/blackberry/bbrotationsensor.cpp @@ -137,9 +137,9 @@ bool BbRotationSensor::updateReadingFromEvent(const sensor_event_t &event, QRota matrixToEulerZXY(event.rotation_matrix, xRad, yRad, zRad); } - reading->setX(radiansToDegrees(xRad)); - reading->setY(radiansToDegrees(yRad)); - reading->setZ(radiansToDegrees(zRad)); + reading->setFromEuler(radiansToDegrees(xRad), + radiansToDegrees(yRad), + radiansToDegrees(zRad)); return true; } diff --git a/src/plugins/sensors/generic/genericrotationsensor.cpp b/src/plugins/sensors/generic/genericrotationsensor.cpp index 7142227c..dddacb24 100644 --- a/src/plugins/sensors/generic/genericrotationsensor.cpp +++ b/src/plugins/sensors/generic/genericrotationsensor.cpp @@ -107,9 +107,7 @@ bool genericrotationsensor::filter(QSensorReading *reading) } m_reading.setTimestamp(ar->timestamp()); - m_reading.setX(pitch); - m_reading.setY(roll); - m_reading.setZ(0); + m_reading.setFromEuler(pitch, roll, 0); newReadingAvailable(); return false; } -- cgit v1.2.3