summaryrefslogtreecommitdiff
path: root/examples/sensors
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2012-08-17 11:51:21 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-09 20:35:30 +0200
commitceb982907c98d2e71e1d7b84c87b06328c6c391f (patch)
treedfd94bef83dc61c481edaac6b82f84835c1092a6 /examples/sensors
parent3c599b87f33673932a55f3f5621073885dea5bc1 (diff)
downloadqtsensors-ceb982907c98d2e71e1d7b84c87b06328c6c391f.tar.gz
Remove the QtSensors 5.0 import
The gesture tests that were part of the sensors2 unit test have been retained. The tilt sensor tests were not, though they could be used as a base to make a unit test for the new tilt sensor class. Change any existing imports to use QtMobility.sensors 1.3. Change-Id: I8a7130b3c73980fdd577e96c10aecda15e79f8b2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'examples/sensors')
-rw-r--r--examples/sensors/maze/maze.qml6
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.qml106
-rw-r--r--examples/sensors/qmlsensorgestures/GestureList.qml2
-rw-r--r--examples/sensors/qmlsensorgestures/GestureView.qml2
-rw-r--r--examples/sensors/qmlsensorgestures/GesturesView.qml2
-rw-r--r--examples/sensors/qmlsensorgestures/qmlsensorgestures.qml2
-rw-r--r--examples/sensors/shakeit/shakeit.qml2
7 files changed, 26 insertions, 96 deletions
diff --git a/examples/sensors/maze/maze.qml b/examples/sensors/maze/maze.qml
index 4626287..8610329 100644
--- a/examples/sensors/maze/maze.qml
+++ b/examples/sensors/maze/maze.qml
@@ -73,7 +73,7 @@ import QtQuick 2.0
import "components"
//! [0]
-import QtSensors 5.0
+import QtMobility.sensors 1.3
//! [0]
import QtSystemInfo 5.0
@@ -202,10 +202,10 @@ ApplicationWindow {
//! [3]
var xstep = 0;
- xstep = tiltSensor.yRotation * 0.1 //acceleration
+ xstep = tiltSensor.reading.yRotation * 0.1 //acceleration
var ystep = 0;
- ystep = tiltSensor.xRotation * 0.1 //acceleration
+ ystep = tiltSensor.reading.xRotation * 0.1 //acceleration
//! [3]
//! [4]
if (xstep < 1 && xstep > 0)
diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.qml b/examples/sensors/qmlqtsensors/qmlqtsensors.qml
index d285cc9..8f6f49b 100644
--- a/examples/sensors/qmlqtsensors/qmlqtsensors.qml
+++ b/examples/sensors/qmlqtsensors/qmlqtsensors.qml
@@ -88,7 +88,7 @@ import QtQuick 2.0
import "components"
//! [0]
-import QtSensors 5.0
+import QtMobility.sensors 1.3
//! [0]
ApplicationWindow {
@@ -147,81 +147,11 @@ ApplicationWindow {
//! [1]
TiltSensor {
id: tilt
- enabled: false
- speed: TiltSensor.Slow
+ active: false
}
//! [1]
Rectangle{
- id: speedRect
- anchors.top: labelTilt.bottom
- anchors.topMargin: 5
- anchors.left: mainWnd.left
- anchors.leftMargin: mainWnd.width / 2
- anchors.right: mainWnd.right
- anchors.rightMargin: 5
- height: 110
- color: "transparent"
-
- Text{
- id: textSpeed
- anchors.top: speedRect.top
- anchors.left: speedRect.left
- text: "Speed"
- font.bold: true
- }
-
- Text{
- id: textSpeedValue
- anchors.top: textSpeed.bottom
- anchors.topMargin: 5
- anchors.left: speedLower.left
- anchors.right: speedHigher.right
- text: mainWnd.speed
- verticalAlignment: Text.AlignVCenter
- }
-
- Button{
- id: speedLower
- anchors.top: textSpeedValue.bottom
- anchors.left: speedRect.left
- height: 30
- width: 40
- text: "-"
-
- onClicked:{
- if (tilt.speed === TiltSensor.Fast) {
- mainWnd.speed = "Medium";
- tilt.speed = TiltSensor.Medium;
- }
- else if (tilt.speed === TiltSensor.Medium) {
- mainWnd.speed = "Slow";
- tilt.speed = TiltSensor.Slow;
- }
- }
- }
-
- Button{
- id: speedHigher
- anchors.top: textSpeedValue.bottom
- anchors.left: speedLower.right
- height: 30
- width: 40
- text: "+"
-
- onClicked:{
- if (tilt.speed === TiltSensor.Slow) {
- mainWnd.speed = "Medium";
- tilt.speed = TiltSensor.Medium;
- }
- else if (tilt.speed === TiltSensor.Medium) {
- mainWnd.speed = "Fast";
- tilt.speed = TiltSensor.Fast;
- }
- }
- }
- }
-
Button{
id: calibrate
anchors.left: mainWnd.left
@@ -243,11 +173,11 @@ ApplicationWindow {
anchors.leftMargin: 5
height: 30
width: 80
- text: tilt.enabled ? "Stop" : "Start"
+ text: tilt.active ? "Stop" : "Start"
onClicked:{
//! [2]
- tilt.enabled = (tiltStart.text === "Start" ? true: false);
+ tilt.active = (tiltStart.text === "Start");
//! [2]
}
}
@@ -309,20 +239,20 @@ ApplicationWindow {
AmbientLightSensor {
id: ambientlight
- enabled: false
+ active: false
//! [5]
- onLightLevelChanged:{
- if (ambientlight.lightLevel == AmbientLightSensor.Unknown)
+ onReadingChanged:{
+ if (reading.lightLevel == AmbientLightSensor.Unknown)
ambientlighttext.text = "Ambient light: Unknown";
- else if (ambientlight.lightLevel == AmbientLightSensor.Dark)
+ else if (reading.lightLevel == AmbientLightSensor.Dark)
ambientlighttext.text = "Ambient light: Dark";
- else if (ambientlight.lightLevel == AmbientLightSensor.Twilight)
+ else if (reading.lightLevel == AmbientLightSensor.Twilight)
ambientlighttext.text = "Ambient light: Twilight";
- else if (ambientlight.lightLevel == AmbientLightSensor.Light)
+ else if (reading.lightLevel == AmbientLightSensor.Light)
ambientlighttext.text = "Ambient light: Light";
- else if (ambientlight.lightLevel == AmbientLightSensor.Bright)
+ else if (reading.lightLevel == AmbientLightSensor.Bright)
ambientlighttext.text = "Ambient light: Bright";
- else if (ambientlight.lightLevel == AmbientLightSensor.Sunny)
+ else if (reading.lightLevel == AmbientLightSensor.Sunny)
ambientlighttext.text = "Ambient light: Sunny";
}
//! [5]
@@ -336,10 +266,10 @@ ApplicationWindow {
anchors.leftMargin: 5
height: 30
width: 80
- text: ambientlight.enabled ? "Stop" : "Start"
+ text: ambientlight.active ? "Stop" : "Start"
onClicked:{
- ambientlight.enabled = (ambientlightStart.text === "Start" ? true: false);
+ ambientlight.active = (ambientlightStart.text === "Start" ? true: false);
}
}
@@ -381,7 +311,7 @@ ApplicationWindow {
ProximitySensor {
id: proxi
- enabled: false
+ active: false
}
Button{
@@ -392,10 +322,10 @@ ApplicationWindow {
anchors.leftMargin: 5
height: 30
width: 80
- text: proxi.enabled ? "Stop" : "Start"
+ text: proxi.active ? "Stop" : "Start"
onClicked:{
- proxi.enabled = (proxiStart.text === "Start" ? true: false);
+ proxi.active = (proxiStart.text === "Start" ? true: false);
}
}
@@ -407,7 +337,7 @@ ApplicationWindow {
anchors.bottom: proxiStart.bottom
verticalAlignment: Text.AlignVCenter
//! [6]
- text: "Proximity: " + (proxi.near ? "near" : "far")
+ text: "Proximity: " + (proxi.reading.near ? "near" : "far")
//! [6]
}
}
diff --git a/examples/sensors/qmlsensorgestures/GestureList.qml b/examples/sensors/qmlsensorgestures/GestureList.qml
index ea79af3..993fb43 100644
--- a/examples/sensors/qmlsensorgestures/GestureList.qml
+++ b/examples/sensors/qmlsensorgestures/GestureList.qml
@@ -40,7 +40,7 @@
//Import the declarative plugins
import QtQuick 2.0
-import QtSensors 5.0
+import QtMobility.sensors 1.3
/* Layout
gesturerect
diff --git a/examples/sensors/qmlsensorgestures/GestureView.qml b/examples/sensors/qmlsensorgestures/GestureView.qml
index c12c6f2..f1b0cb6 100644
--- a/examples/sensors/qmlsensorgestures/GestureView.qml
+++ b/examples/sensors/qmlsensorgestures/GestureView.qml
@@ -42,7 +42,7 @@
import QtQuick 2.0
//! [0]
-import QtSensors 5.0
+import QtMobility.sensors 1.3
//! [0]
/* Layout
diff --git a/examples/sensors/qmlsensorgestures/GesturesView.qml b/examples/sensors/qmlsensorgestures/GesturesView.qml
index ceab8d1..df91df6 100644
--- a/examples/sensors/qmlsensorgestures/GesturesView.qml
+++ b/examples/sensors/qmlsensorgestures/GesturesView.qml
@@ -40,7 +40,7 @@
//Import the declarative plugins
import QtQuick 2.0
-import QtSensors 5.0
+import QtMobility.sensors 1.3
/* Layout
gesturerect
diff --git a/examples/sensors/qmlsensorgestures/qmlsensorgestures.qml b/examples/sensors/qmlsensorgestures/qmlsensorgestures.qml
index af1f04a..2f76580 100644
--- a/examples/sensors/qmlsensorgestures/qmlsensorgestures.qml
+++ b/examples/sensors/qmlsensorgestures/qmlsensorgestures.qml
@@ -40,7 +40,7 @@
//Import the declarative plugins
import QtQuick 2.0
-import QtSensors 5.0
+import QtMobility.sensors 1.3
/* Layout
--------------------------------------------------
diff --git a/examples/sensors/shakeit/shakeit.qml b/examples/sensors/shakeit/shakeit.qml
index 00eeb26..d1a142b 100644
--- a/examples/sensors/shakeit/shakeit.qml
+++ b/examples/sensors/shakeit/shakeit.qml
@@ -41,7 +41,7 @@
import QtQuick 2.0
//! [0]
-import QtSensors 5.0
+import QtMobility.sensors 1.3
//! [0]
import QtMultimedia 5.0