summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2011-12-02 12:03:42 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-05 01:49:15 +0100
commit44255a0b3042633aec46cae0a6fc192d19389fb3 (patch)
tree30f84fe3f597faf43a98be153fb50f24bdf5b5a6 /examples
parent3953c936b2259ddc7a3c394f124849e1a64e1952 (diff)
Tutorial doc for tilt abl and proxi qml sensors
Change-Id: Ie7aac8003aea91e7cef5a3db336e736500fd7949 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lorn Potter <lorn.potter@nokia.com> Reviewed-by: Wolfgang Beck <wolfgang.beck@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/sensors/qmlqtsensors5/main.qml17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/sensors/qmlqtsensors5/main.qml b/examples/sensors/qmlqtsensors5/main.qml
index cf20a6a3..9190dcb4 100644
--- a/examples/sensors/qmlqtsensors5/main.qml
+++ b/examples/sensors/qmlqtsensors5/main.qml
@@ -40,7 +40,10 @@
//Import the declarative plugins
import QtQuick 2.0
+
+//! [0]
import QtSensors 5.0
+//! [0]
/* Layout
tiltrect
@@ -89,12 +92,14 @@ Rectangle {
height: 270
border.width: 1
+//! [1]
TiltSensor {
id: tilt
unit: TiltSensor.Degrees
enabled: false
accuracy: 1.0
}
+//! [1]
Text{
id: textAccuracy
@@ -233,13 +238,17 @@ Rectangle {
id: xrottext
x:5
y:195
+//! [3]
text: "X Rotation: " + tilt.xRotation
+//! [3]
}
Text {
id: yrottext
x:5
y:220
+//! [4]
text: "Y Rotation: " + tilt.yRotation
+//! [4]
}
Button{
id: tiltStart
@@ -252,7 +261,9 @@ Rectangle {
checked: tilt.enabled
onClicked:{
+//! [2]
tilt.enabled = tiltStart.checked;
+//! [2]
if (tiltStart.checked)
tiltStart.text = "running";
else
@@ -273,8 +284,10 @@ Rectangle {
id: ambientlight
enabled: false
onLightLevelChanged:{
+//! [5]
if (ambientlight.lightLevel == AmbientLightSensor.Unknown)
ambientlighttext.text = "Ambient light: Unknown";
+//! [5]
else if (ambientlight.lightLevel == AmbientLightSensor.Dark)
ambientlighttext.text = "Ambient light: Dark";
else if (ambientlight.lightLevel == AmbientLightSensor.Twilight)
@@ -287,6 +300,7 @@ Rectangle {
ambientlighttext.text = "Ambient light: Sunny";
}
}
+
Text {
id: ambientlighttext
x: 5
@@ -325,6 +339,7 @@ Rectangle {
id: proxi
enabled: true
}
+
Text {
id: proxitext
x: 5
@@ -335,7 +350,9 @@ Rectangle {
id: proxiStart
x: 5
y: 35
+//! [6]
text: proxi.enabled ? "running" : "start"
+//! [6]
checkColor: "lightblue"
unCheckColor: "lightyellow"
color: proxi.enabled ? checkColor : unCheckColor