diff options
Diffstat (limited to 'src/imports/sensors')
-rw-r--r-- | src/imports/sensors/plugins.qmltypes | 4 | ||||
-rw-r--r-- | src/imports/sensors/qmlrotationsensor.cpp | 3 | ||||
-rw-r--r-- | src/imports/sensors/qmlrotationsensor.h | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes index 86ba0ad0..97a2bcd1 100644 --- a/src/imports/sensors/plugins.qmltypes +++ b/src/imports/sensors/plugins.qmltypes @@ -170,6 +170,10 @@ Module { prototype: "QmlSensor" exports: ["RotationSensor 5.0", "RotationSensor 5.1"] Property { name: "hasZ"; type: "bool"; isReadonly: true } + Signal { + name: "hasZChanged" + Parameter { name: "hasZ"; type: "bool" } + } } Component { name: "QmlRotationSensorReading" diff --git a/src/imports/sensors/qmlrotationsensor.cpp b/src/imports/sensors/qmlrotationsensor.cpp index e58a3f8c..f1821641 100644 --- a/src/imports/sensors/qmlrotationsensor.cpp +++ b/src/imports/sensors/qmlrotationsensor.cpp @@ -65,6 +65,7 @@ QmlRotationSensor::QmlRotationSensor(QObject *parent) : QmlSensor(parent) , m_sensor(new QRotationSensor(this)) { + connect(m_sensor, SIGNAL(hasZChanged(bool)), this, SIGNAL(hasZChanged(bool))); } QmlRotationSensor::~QmlRotationSensor() @@ -90,7 +91,7 @@ QSensor *QmlRotationSensor::sensor() const bool QmlRotationSensor::hasZ() const { - return m_sensor->property("hasZ").toBool(); + return m_sensor->hasZ(); } void QmlRotationSensor::_update() diff --git a/src/imports/sensors/qmlrotationsensor.h b/src/imports/sensors/qmlrotationsensor.h index 105b0fb8..4d7b543a 100644 --- a/src/imports/sensors/qmlrotationsensor.h +++ b/src/imports/sensors/qmlrotationsensor.h @@ -51,13 +51,15 @@ class QRotationSensor; class QmlRotationSensor : public QmlSensor { Q_OBJECT - Q_PROPERTY(bool hasZ READ hasZ) + Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged) public: explicit QmlRotationSensor(QObject *parent = 0); ~QmlRotationSensor(); bool hasZ() const; +Q_SIGNALS: + void hasZChanged(bool hasZ); private: QSensor *sensor() const Q_DECL_OVERRIDE; |