summaryrefslogtreecommitdiffstats
path: root/examples/sensors
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@theqtcompany.com>2015-12-03 08:29:20 +0100
committerOliver Wolff <oliver.wolff@theqtcompany.com>2015-12-03 08:01:52 +0000
commit2494c271d49f30e783cba20dd430b64bb9261702 (patch)
treef9e4dddc6d6a33aad23e461c9700f81044f6ae45 /examples/sensors
parentd8d4a5e9ac1251e82d1ec639bc3bff7e7f53c083 (diff)
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 <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/sensors')
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.qml18
1 files 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]
}
}