From 2494c271d49f30e783cba20dd430b64bb9261702 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 Dec 2015 08:29:20 +0100 Subject: Fixed qmlqtsensors example There were API changes, that broke the current version. Both the tilt sensor's value and the ambient light sensor's enum value are now part of the reading's instead of the sensor's API. Change-Id: I774ecbcacdcce537358fdb0f3a6794a89572742d Reviewed-by: Alex Blasche --- examples/sensors/qmlqtsensors/qmlqtsensors.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.qml b/examples/sensors/qmlqtsensors/qmlqtsensors.qml index bc456be5..40492c71 100644 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.qml +++ b/examples/sensors/qmlqtsensors/qmlqtsensors.qml @@ -106,18 +106,18 @@ ApplicationWindow { active: false //! [5] onReadingChanged: { - if (reading.lightLevel == AmbientLightSensor.Unknown) - ambientlighttext.text = "Ambient light: Unknown"; - else if (reading.lightLevel == AmbientLightSensor.Dark) + if (reading.lightLevel == AmbientLightReading.Dark) ambientlighttext.text = "Ambient light: Dark"; - else if (reading.lightLevel == AmbientLightSensor.Twilight) + else if (reading.lightLevel == AmbientLightReading.Twilight) ambientlighttext.text = "Ambient light: Twilight"; - else if (reading.lightLevel == AmbientLightSensor.Light) + else if (reading.lightLevel == AmbientLightReading.Light) ambientlighttext.text = "Ambient light: Light"; - else if (reading.lightLevel == AmbientLightSensor.Bright) + else if (reading.lightLevel == AmbientLightReading.Bright) ambientlighttext.text = "Ambient light: Bright"; - else if (reading.lightLevel == AmbientLightSensor.Sunny) + else if (reading.lightLevel == AmbientLightReading.Sunny) ambientlighttext.text = "Ambient light: Sunny"; + else + ambientlighttext.text = "Ambient light: Unknown"; } //! [5] } @@ -160,7 +160,7 @@ ApplicationWindow { height: 30 verticalAlignment: Text.AlignVCenter //! [3] - text: "X Rotation: " + tilt.xRotation + "°" + text: "X Rotation: " + (tilt.reading ? tilt.reading.xRotation.toFixed(2) + "°" : "Unknown") //! [3] } } @@ -184,7 +184,7 @@ ApplicationWindow { height: 30 verticalAlignment: Text.AlignVCenter //! [4] - text: "Y Rotation: " + tilt.yRotation + "°" + text: "Y Rotation: " + (tilt.reading ? tilt.reading.yRotation.toFixed(2) + "°" : "Unknown") //! [4] } } -- cgit v1.2.3 From 13fd3e9611391742b4bea86cb2f4740534daf695 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 2 Dec 2015 13:17:30 +0100 Subject: winrt: Fix application hang on sensor start/stop If addition and removal are not done in the Xaml thread, the functions might not return at all. Task-number: QTBUG-49741 Change-Id: Iabdea2c7ee18bf851ab70adfeb28b09781b8b609 Reviewed-by: Andrew Knight Reviewed-by: Maurice Kalinowski --- src/plugins/sensors/winrt/winrt.pro | 2 +- src/plugins/sensors/winrt/winrtaccelerometer.cpp | 42 ++++++++++++-------- .../sensors/winrt/winrtambientlightsensor.cpp | 42 ++++++++++++-------- src/plugins/sensors/winrt/winrtcompass.cpp | 45 +++++++++++++--------- src/plugins/sensors/winrt/winrtgyroscope.cpp | 42 ++++++++++++-------- .../sensors/winrt/winrtorientationsensor.cpp | 42 ++++++++++++-------- src/plugins/sensors/winrt/winrtrotationsensor.cpp | 42 ++++++++++++-------- 7 files changed, 156 insertions(+), 101 deletions(-) diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro index 4a03bf2e..67ae5304 100644 --- a/src/plugins/sensors/winrt/winrt.pro +++ b/src/plugins/sensors/winrt/winrt.pro @@ -1,5 +1,5 @@ TARGET = qtsensors_winrt -QT = sensors core +QT = sensors core core_private PLUGIN_TYPE = sensors PLUGIN_CLASS_NAME = WinRtSensorPlugin diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.cpp b/src/plugins/sensors/winrt/winrtaccelerometer.cpp index f2728a86..fba9594c 100644 --- a/src/plugins/sensors/winrt/winrtaccelerometer.cpp +++ b/src/plugins/sensors/winrt/winrtaccelerometer.cpp @@ -38,7 +38,9 @@ #include "winrtcommon.h" #include +#include +#include #include #include using namespace Microsoft::WRL; @@ -114,20 +116,24 @@ WinRtAccelerometer::WinRtAccelerometer(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtAccelerometerPrivate(this)) { Q_D(WinRtAccelerometer); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default accelerometer." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default accelerometer." - << qt_error_string(hr); sensorError(hr); return; } @@ -158,9 +164,11 @@ void WinRtAccelerometer::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtAccelerometerPrivate::readingChanged); - HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token); + return d->sensor->add_ReadingChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -189,14 +197,16 @@ void WinRtAccelerometer::stop() if (!d->token.value) return; - HRESULT hr = d->sensor->remove_ReadingChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_ReadingChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); sensorError(hr); return; } - d->sensor->put_ReportInterval(0); + hr = d->sensor->put_ReportInterval(0); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to reset report interval." << qt_error_string(hr); diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp index b1e1c52c..d0d7fd7d 100644 --- a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp +++ b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp @@ -38,7 +38,9 @@ #include "winrtcommon.h" #include +#include +#include #include #include using namespace Microsoft::WRL; @@ -113,20 +115,24 @@ WinRtAmbientLightSensor::WinRtAmbientLightSensor(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtAmbientLightSensorPrivate(this)) { Q_D(WinRtAmbientLightSensor); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default light sensor." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default light sensor." - << qt_error_string(hr); sensorError(hr); return; } @@ -157,9 +163,11 @@ void WinRtAmbientLightSensor::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtAmbientLightSensorPrivate::readingChanged); - HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token); + return d->sensor->add_ReadingChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -188,14 +196,16 @@ void WinRtAmbientLightSensor::stop() if (!d->token.value) return; - HRESULT hr = d->sensor->remove_ReadingChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_ReadingChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); sensorError(hr); return; } - d->sensor->put_ReportInterval(0); + hr = d->sensor->put_ReportInterval(0); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to reset report interval." << qt_error_string(hr); diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp index 9c57db9d..22f4ac5b 100644 --- a/src/plugins/sensors/winrt/winrtcompass.cpp +++ b/src/plugins/sensors/winrt/winrtcompass.cpp @@ -38,9 +38,9 @@ #include "winrtcommon.h" #include +#include -QT_USE_NAMESPACE - +#include #include #include using namespace Microsoft::WRL; @@ -133,20 +133,24 @@ WinRtCompass::WinRtCompass(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtCompassPrivate(this)) { Q_D(WinRtCompass); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default compass." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default compass." - << qt_error_string(hr); sensorError(hr); return; } @@ -177,9 +181,11 @@ void WinRtCompass::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtCompassPrivate::readingChanged); - HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token); + return d->sensor->add_ReadingChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -207,15 +213,16 @@ void WinRtCompass::stop() return; if (!d->token.value) return; - - HRESULT hr = d->sensor->remove_ReadingChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_ReadingChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); sensorError(hr); return; } - d->sensor->put_ReportInterval(0); + hr = d->sensor->put_ReportInterval(0); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to reset report interval." << qt_error_string(hr); diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp index e7910ab2..70d7980f 100644 --- a/src/plugins/sensors/winrt/winrtgyroscope.cpp +++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp @@ -38,7 +38,9 @@ #include "winrtcommon.h" #include +#include +#include #include #include using namespace Microsoft::WRL; @@ -111,20 +113,24 @@ WinRtGyroscope::WinRtGyroscope(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtGyroscopePrivate(this)) { Q_D(WinRtGyroscope); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor." - << qt_error_string(hr); sensorError(hr); return; } @@ -155,9 +161,11 @@ void WinRtGyroscope::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtGyroscopePrivate::readingChanged); - HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token); + return d->sensor->add_ReadingChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -186,14 +194,16 @@ void WinRtGyroscope::stop() if (!d->token.value) return; - HRESULT hr = d->sensor->remove_ReadingChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_ReadingChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); sensorError(hr); return; } - d->sensor->put_ReportInterval(0); + hr = d->sensor->put_ReportInterval(0); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to reset report interval." << qt_error_string(hr); diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.cpp b/src/plugins/sensors/winrt/winrtorientationsensor.cpp index a40dbb9d..c679d925 100644 --- a/src/plugins/sensors/winrt/winrtorientationsensor.cpp +++ b/src/plugins/sensors/winrt/winrtorientationsensor.cpp @@ -38,9 +38,9 @@ #include "winrtcommon.h" #include +#include -QT_USE_NAMESPACE - +#include #include #include using namespace Microsoft::WRL; @@ -119,20 +119,24 @@ WinRtOrientationSensor::WinRtOrientationSensor(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtOrientationSensorPrivate(this)) { Q_D(WinRtOrientationSensor); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor." - << qt_error_string(hr); sensorError(hr); return; } @@ -152,9 +156,11 @@ void WinRtOrientationSensor::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtOrientationSensorPrivate::readingChanged); - HRESULT hr = d->sensor->add_OrientationChanged(callback.Get(), &d->token); + return d->sensor->add_OrientationChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -171,7 +177,9 @@ void WinRtOrientationSensor::stop() if (!d->token.value) return; - HRESULT hr = d->sensor->remove_OrientationChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_OrientationChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.cpp b/src/plugins/sensors/winrt/winrtrotationsensor.cpp index 93c19b0a..570ef0bb 100644 --- a/src/plugins/sensors/winrt/winrtrotationsensor.cpp +++ b/src/plugins/sensors/winrt/winrtrotationsensor.cpp @@ -38,7 +38,9 @@ #include "winrtcommon.h" #include +#include +#include #include #include using namespace Microsoft::WRL; @@ -109,20 +111,24 @@ WinRtRotationSensor::WinRtRotationSensor(QSensor *sensor) : QSensorBackend(sensor), d_ptr(new WinRtRotationSensorPrivate(this)) { Q_D(WinRtRotationSensor); - HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer); - ComPtr factory; - HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); - if (FAILED(hr)) { - qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory." - << qt_error_string(hr); - sensorError(hr); - return; - } + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer); + ComPtr factory; + HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory)); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory." + << qt_error_string(hr); + return hr; + } - hr = factory->GetDefault(&d->sensor); + hr = factory->GetDefault(&d->sensor); + if (FAILED(hr)) { + qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor." + << qt_error_string(hr); + } + return hr; + }); if (FAILED(hr) || !d->sensor) { - qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor." - << qt_error_string(hr); sensorError(hr); return; } @@ -153,9 +159,11 @@ void WinRtRotationSensor::start() if (d->token.value) return; - ComPtr callback = + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr callback = Callback(d, &WinRtRotationSensorPrivate::readingChanged); - HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token); + return d->sensor->add_ReadingChanged(callback.Get(), &d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event." << qt_error_string(hr); @@ -184,14 +192,16 @@ void WinRtRotationSensor::stop() if (!d->token.value) return; - HRESULT hr = d->sensor->remove_ReadingChanged(d->token); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->sensor->remove_ReadingChanged(d->token); + }); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event." << qt_error_string(hr); sensorError(hr); return; } - d->sensor->put_ReportInterval(0); + hr = d->sensor->put_ReportInterval(0); if (FAILED(hr)) { qCWarning(lcWinRtSensors) << "Unable to reset report interval." << qt_error_string(hr); -- cgit v1.2.3 From c398c3a93edfdb3e4f9aa4fda7eb1c981333dd03 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 Dec 2015 12:30:06 +0100 Subject: Make GenericTiltSensor::calibrate known to QMetaObject When using qml calibrating the tilt sensor does not work on WinRT and Windows Phone without this change. QmlTiltsensor::calibrate calls QTiltSensor::calibrate which calls QMetaObject::invokeMethod with "calibrate" on its backend. That causes the message "No such method QSensorBackend::calibrate()" without this change. Thus the meta system has to be made aware of that function. Change-Id: I539c0fb44e20fffb78bf515ba3767dafa3ce4ed6 Reviewed-by: Alex Blasche Reviewed-by: Maurice Kalinowski --- src/plugins/sensors/generic/generictiltsensor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/sensors/generic/generictiltsensor.h b/src/plugins/sensors/generic/generictiltsensor.h index a5a8f428..0f99f555 100644 --- a/src/plugins/sensors/generic/generictiltsensor.h +++ b/src/plugins/sensors/generic/generictiltsensor.h @@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE class GenericTiltSensor : public QSensorBackend, public QAccelerometerFilter { + Q_OBJECT public: static char const * const id; @@ -51,7 +52,7 @@ public: void start() Q_DECL_OVERRIDE; void stop() Q_DECL_OVERRIDE; - void calibrate(); + Q_INVOKABLE void calibrate(); bool filter(QAccelerometerReading *reading) Q_DECL_OVERRIDE; -- cgit v1.2.3 From b8bb154a30d9f35cc19d9056599750267d2f2a80 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Thu, 17 Dec 2015 14:22:53 +0100 Subject: Doc: Remove an obsolete external link. Change-Id: I88eba8f9d5ad0633bf58692245c80cc767d2ab67 Task-number: QTBUG-50013 Reviewed-by: Alex Blasche --- src/sensors/qcompass.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sensors/qcompass.cpp b/src/sensors/qcompass.cpp index e42014fc..d4ad19fb 100644 --- a/src/sensors/qcompass.cpp +++ b/src/sensors/qcompass.cpp @@ -61,7 +61,6 @@ IMPLEMENT_READING(QCompassReading) The calibration status of the device is measured as a number from 0 to 1. A value of 1 is the highest level that the device can support and 0 is the worst. - \sa {http://wiki.forum.nokia.com/index.php/CS001671_-_Calibrating_the_magnetometer_sensor}{CS001671 - Calibrating the magnetometer sensor} */ /*! -- cgit v1.2.3 From 3b334c8e10628a362f54651884a6552966e74a02 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 23 Dec 2015 10:33:43 +0100 Subject: Fix inconsistent use of 'override'. Change-Id: If952d7f9a0888a16c87bc75a96105c5eabc24377 Reviewed-by: Lorn Potter --- src/imports/sensors/qmlrotationsensor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/sensors/qmlrotationsensor.h b/src/imports/sensors/qmlrotationsensor.h index c46c72a6..be745698 100644 --- a/src/imports/sensors/qmlrotationsensor.h +++ b/src/imports/sensors/qmlrotationsensor.h @@ -55,7 +55,7 @@ Q_SIGNALS: private: QSensor *sensor() const Q_DECL_OVERRIDE; - void _update(); + void _update() Q_DECL_OVERRIDE; QRotationSensor *m_sensor; QmlSensorReading *createReading() const Q_DECL_OVERRIDE; }; -- cgit v1.2.3 From e9e4d351df2167a2326608c170131222bef7fff7 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 4 Jan 2016 08:52:32 +0100 Subject: Android: Document that Compass works on Android Task-number: QTBUG-50165 Change-Id: I1fedc47b19832c8c8400ca28314e2a374d5714de Reviewed-by: Lorn Potter --- src/sensors/doc/src/compatmap.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc index c976014b..8362703d 100644 --- a/src/sensors/doc/src/compatmap.qdoc +++ b/src/sensors/doc/src/compatmap.qdoc @@ -103,7 +103,7 @@ Compass - + -- cgit v1.2.3 From ad52d307cbff44b77bf7d4fa923377b72bb04374 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 2 Feb 2016 09:12:01 +0100 Subject: Update qml types for QtSensors 5.6.0 release Change-Id: I9606b50810c63e49f6821e5188df54417601d11a Reviewed-by: Oliver Wolff --- src/imports/sensors/plugins.qmltypes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes index 746230ba..2c72e1ff 100644 --- a/src/imports/sensors/plugins.qmltypes +++ b/src/imports/sensors/plugins.qmltypes @@ -7,7 +7,7 @@ import QtQuick.tooling 1.2 // 'qmlplugindump -nonrelocatable QtSensors 5.6' Module { - dependencies: [] + dependencies: ["QtQuick 2.0"] Component { name: "QmlAccelerometer" prototype: "QmlSensor" -- cgit v1.2.3 From fbaca62cd0a7309f04bf82101c8e20dbbf423192 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 8 Feb 2016 14:56:24 +0100 Subject: Bump version Change-Id: I3cdf3ef0e748de5900ffe36ad88d74683362cabe --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 66a0241e..b6425273 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.6.0 +MODULE_VERSION = 5.6.1 -- cgit v1.2.3