summaryrefslogtreecommitdiffstats
path: root/examples/sensors/grue/qml_app/main.qml
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2011-12-15 14:11:46 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-20 04:38:54 +0100
commit52a414bd2291dbf9b99606019ab50a914280ecb0 (patch)
treee9c25309ea7aa6c121b688459ab491436406e9e8 /examples/sensors/grue/qml_app/main.qml
parent72a3d3b60b20abbc7e6af2ec1e33275bfa7841b1 (diff)
Grue example doesn't work in simulator
Change-Id: I486e24befd3f31345ec7f8dffd9a183f9f2ec4cb Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'examples/sensors/grue/qml_app/main.qml')
-rw-r--r--examples/sensors/grue/qml_app/main.qml16
1 files changed, 7 insertions, 9 deletions
diff --git a/examples/sensors/grue/qml_app/main.qml b/examples/sensors/grue/qml_app/main.qml
index f3ae6ed1..5177b04f 100644
--- a/examples/sensors/grue/qml_app/main.qml
+++ b/examples/sensors/grue/qml_app/main.qml
@@ -50,24 +50,22 @@ Item {
GrueSensor {
id: sensor
active: true
- property int lastPercent: 0
onReadingChanged: {
- var percent = Math.floor(reading.chanceOfBeingEaten * 100);
+ var percent = reading.chanceOfBeingEaten;
var thetext = "";
- if (percent == 0) {
+ if (percent === 0) {
thetext = "It is light. You are safe from Grues.";
- } else if (lastPercent == 0) {
- thetext = "It is dark. You are likely to be eaten by a Grue.";
}
- if (percent == 100) {
- thetext += " You have been eaten by a Grue!";
+ else if (percent === 100) {
+ thetext = "You have been eaten by a Grue!";
sensor.active = false;
- } else if (percent) {
+ }
+ else if (percent > 0) {
+ thetext = "It is dark. You are likely to be eaten by a Grue.";
thetext += " Your chance of being eaten by a Grue: "+percent+" percent.";
}
text.font.pixelSize = 30;
text.text = "<p>" + thetext + "</p>";
- lastPercent = percent;
}
}