summaryrefslogtreecommitdiffstats
path: root/src/sensors/qrotationsensor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sensors/qrotationsensor.cpp')
-rw-r--r--src/sensors/qrotationsensor.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/sensors/qrotationsensor.cpp b/src/sensors/qrotationsensor.cpp
index 9acc1cd8..06ee4064 100644
--- a/src/sensors/qrotationsensor.cpp
+++ b/src/sensors/qrotationsensor.cpp
@@ -201,7 +201,7 @@ char const * const QRotationSensor::type("QRotationSensor");
Construct the sensor as a child of \a parent.
*/
QRotationSensor::QRotationSensor(QObject *parent)
- : QSensor(QRotationSensor::type, parent)
+ : QSensor(QRotationSensor::type, *new QRotationSensorPrivate, parent)
{
}
@@ -228,6 +228,28 @@ QRotationSensor::~QRotationSensor()
Returns false if z is not available.
*/
+bool QRotationSensor::hasZ() const
+{
+ Q_D(const QRotationSensor);
+ return (d->hasZ);
+}
+
+/*!
+ \since 5.1
+
+ Sets whether the z angle is available to \a hasZ. This is to be called from the
+ backend. By default the hasZ property is true, so a backend only has to
+ call this if its rotation sensor can not report z angles.
+*/
+void QRotationSensor::setHasZ(bool hasZ)
+{
+ Q_D(QRotationSensor);
+ if (d->hasZ != hasZ) {
+ d->hasZ = hasZ;
+ emit hasZChanged(hasZ);
+ }
+}
+
#include "moc_qrotationsensor.cpp"
QT_END_NAMESPACE