diff options
author | Wolfgang Beck <wolfgang.beck@nokia.com> | 2011-12-08 13:28:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-09 00:11:08 +0100 |
commit | 3b8c985084be2698745386f9618f26b04d475367 (patch) | |
tree | a702bd1493152f93f239dbdaebcced74f3b62b61 /examples | |
parent | 2a345c6af2201d02b5685187f9db0911969bbf2e (diff) | |
download | qtsensors-3b8c985084be2698745386f9618f26b04d475367.tar.gz |
Add tutorial for cubehouse example
Change-Id: I6058e9f5965d99e669ac845357916943d370f734
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Reviewed-by: Wolfgang Beck <wolfgang.beck@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sensors/cubehouse/Cubehouse.qml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/sensors/cubehouse/Cubehouse.qml b/examples/sensors/cubehouse/Cubehouse.qml index 8ea06de..2aa1480 100644 --- a/examples/sensors/cubehouse/Cubehouse.qml +++ b/examples/sensors/cubehouse/Cubehouse.qml @@ -41,7 +41,11 @@ import QtQuick 2.0 import Qt3D 1.0 import Qt3D.Shapes 1.0 + +//! [0] import QtMobility.sensors 1.3 +//! [0] + import "." Item { @@ -75,19 +79,28 @@ Item { } } +//! [1] Accelerometer { id: accel active: true +//! [1] + +//! [2] property double pitch: 0.0 property double roll: 0.0 +//! [2] +//! [3] onReadingChanged: { pitch = -(Math.atan2(reading.x, Math.sqrt(reading.y * reading.y + reading.z * reading.z)) * 180) / Math.PI; roll = (Math.atan2(reading.y, Math.sqrt(reading.x * reading.x + reading.z * reading.z)) * 180) / Math.PI; } } +//! [3] + //Timer to read out the x and y rotation of the TiltSensor +//! [4] Timer { interval: 150; running: true; repeat: true @@ -96,4 +109,5 @@ Item { view.rotateX(accel.roll); } } +//! [4] } |