summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/sensors/maze/maze.qml2
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.qml87
2 files changed, 4 insertions, 85 deletions
diff --git a/examples/sensors/maze/maze.qml b/examples/sensors/maze/maze.qml
index 46775056..46262877 100644
--- a/examples/sensors/maze/maze.qml
+++ b/examples/sensors/maze/maze.qml
@@ -173,9 +173,7 @@ ApplicationWindow {
//! [1]
TiltSensor{
id: tiltSensor
- unit: TiltSensor.Degrees
enabled: true
- accuracy: 5.0
}
//! [1]
diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.qml b/examples/sensors/qmlqtsensors/qmlqtsensors.qml
index fe21c4b4..d285cc94 100644
--- a/examples/sensors/qmlqtsensors/qmlqtsensors.qml
+++ b/examples/sensors/qmlqtsensors/qmlqtsensors.qml
@@ -102,7 +102,6 @@ ApplicationWindow {
height: 480
color: "transparent"
- property int accuracy: 1
property string speed: "Slow"
Text {
@@ -148,76 +147,12 @@ ApplicationWindow {
//! [1]
TiltSensor {
id: tilt
- unit: TiltSensor.Degrees
enabled: false
- accuracy: 1.0
speed: TiltSensor.Slow
}
//! [1]
Rectangle{
- id: accuracyRect
- anchors.top: labelTilt.bottom
- anchors.topMargin: 5
- anchors.left: mainWnd.left
- anchors.leftMargin: 5
- anchors.right: mainWnd.right
- anchors.rightMargin: mainWnd.width / 2
- height: 110
- color: "transparent"
-
- Text{
- id: textAccuracy
- anchors.top: accuracyRect.top
- anchors.left: accuracyRect.left
- text: "Accuracy"
- font.bold: true
- }
-
- Text{
- id: textAccuracyValue
- anchors.top: textAccuracy.bottom
- anchors.topMargin: 5
- anchors.left: accuracyHigher.left
- anchors.right: accuracyHigher.right
- text: mainWnd.accuracy
- verticalAlignment: Text.AlignVCenter
- }
-
- Button{
- id: accuracyLower
- anchors.top: textAccuracyValue.bottom
- anchors.left: accuracyRect.left
- height: 30
- width: 40
- text: "-"
-
- onClicked:{
- if (mainWnd.accuracy > 1){
- mainWnd.accuracy--;
- tilt.accuracy = mainWnd.accuracy;
- }
- }
- }
-
- Button{
- id: accuracyHigher
- anchors.top: textAccuracyValue.bottom
- anchors.left: accuracyLower.right
- height: 30
- width: 40
- text: "+"
-
- onClicked:{
- if (mainWnd.accuracy < 10){
- mainWnd.accuracy++;
- tilt.accuracy = mainWnd.accuracy;
- }
- }
- }
- }
-
- Rectangle{
id: speedRect
anchors.top: labelTilt.bottom
anchors.topMargin: 5
@@ -291,7 +226,7 @@ ApplicationWindow {
id: calibrate
anchors.left: mainWnd.left
anchors.leftMargin: 5
- anchors.top: accuracyRect.bottom
+ anchors.top: speedRect.bottom
height: 30
width: 80
text: "Calibrate"
@@ -302,22 +237,8 @@ ApplicationWindow {
}
Button{
- id: useRadian
- anchors.top: calibrate.bottom
- anchors.left: mainWnd.left
- anchors.leftMargin: 5
- height: 30
- width: 80
- text: (tilt !== null ? tilt.unit === TiltSensor.Radians ? "Degree" : "Radians" : "Degree")
-
- onClicked:{
- tilt.unit = (useRadian.text === "Radians" ? TiltSensor.Radians : TiltSensor.Degrees);
- }
- }
-
- Button{
id: tiltStart
- anchors.top: useRadian.bottom
+ anchors.top: calibrate.bottom
anchors.left: mainWnd.left
anchors.leftMargin: 5
height: 30
@@ -341,7 +262,7 @@ ApplicationWindow {
anchors.bottom: useRadian.bottom
verticalAlignment: Text.AlignVCenter
//! [3]
- text: "X Rotation: " + tilt.xRotation + (tilt.unit === TiltSensor.Radians ? " rad" : "°")
+ text: "X Rotation: " + tilt.xRotation + "°"
//! [3]
}
@@ -355,7 +276,7 @@ ApplicationWindow {
anchors.bottom: tiltStart.bottom
verticalAlignment: Text.AlignVCenter
//! [4]
- text: "Y Rotation: " + tilt.yRotation + (tilt.unit === TiltSensor.Radians ? " rad" : "°")
+ text: "Y Rotation: " + tilt.yRotation + "°"
//! [4]
}