diff options
author | Rainer Keller <rainer.keller@digia.com> | 2014-06-11 11:25:47 +0200 |
---|---|---|
committer | Rainer Keller <rainer.keller@digia.com> | 2014-06-11 14:11:53 +0300 |
commit | 0d56278af6eace6747bd7c91215f6e5daef8b84e (patch) | |
tree | d6447a31e8e7ff9bbe7294adfed1f52064cffce0 /basicsuite/sensors/Light.qml | |
parent | 1ce9c5aa3d911963b05daf1194f2ad7daab8e491 (diff) |
Show sensors example in landscape view
Show sensors example in landscape view to match the way all
the other examples are presented in the qtlauncher.
Also the calculation is more pysically correct.
Task-number: QTEE-569
Change-Id: I12e1b27e62dfa082d9d768598891a5ce91109436
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Diffstat (limited to 'basicsuite/sensors/Light.qml')
-rw-r--r-- | basicsuite/sensors/Light.qml | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/basicsuite/sensors/Light.qml b/basicsuite/sensors/Light.qml index 0cff8e6..24f3bd9 100644 --- a/basicsuite/sensors/Light.qml +++ b/basicsuite/sensors/Light.qml @@ -41,50 +41,47 @@ import QtQuick 2.0 import QtSensors 5.0 -Item { - rotation: 180 - Rectangle { - id: bg - width: parent.width - height: parent.height - Text { - id: illuminanceLevel - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: 26 - anchors.top: parent.top - } - Image { - id: avatar - anchors.top: illuminanceLevel.bottom - anchors.topMargin: 30 - anchors.centerIn: parent - } +Rectangle { + id: bg + Image { + id: avatar + width: parent.width * 0.9 + height: parent.height * 0.9 + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + } + Text { + id: illuminanceLevel + font.pointSize: 20 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 60 + } - AmbientLightSensor { - active: true - onReadingChanged: { - if (reading.lightLevel === AmbientLightReading.Dark) { - avatar.source = "3.png" - bg.color = "midnightblue" - } else if (reading.lightLevel === AmbientLightReading.Twilight - || reading.lightLevel === AmbientLightReading.Light) { - avatar.source = "2.png" - bg.color = "steelblue" - } else if (reading.lightLevel === AmbientLightReading.Bright - || reading.lightLevel === AmbientLightReading.Sunny) { - avatar.source = "1.png" - bg.color = "yellow" - } else { - avatar.text = "Unknown light level" - } + AmbientLightSensor { + active: true + onReadingChanged: { + if (reading.lightLevel === AmbientLightReading.Dark) { + avatar.source = "3.png" + bg.color = "#1947A3" + } else if (reading.lightLevel === AmbientLightReading.Twilight + || reading.lightLevel === AmbientLightReading.Light) { + avatar.source = "2.png" + bg.color = "steelblue" + } else if (reading.lightLevel === AmbientLightReading.Bright + || reading.lightLevel === AmbientLightReading.Sunny) { + avatar.source = "1.png" + bg.color = "#FFFF75" + } else { + avatar.text = "Unknown light level" } } + } - LightSensor { - active: true - onReadingChanged: { - illuminanceLevel.text = "Illuminance: " + reading.illuminance.toFixed(2); - } + LightSensor { + active: true + onReadingChanged: { + illuminanceLevel.text = "Illuminance: " + reading.illuminance.toFixed(2); } } } |