summaryrefslogtreecommitdiffstats
path: root/basicsuite/sensors/Light.qml
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@digia.com>2014-09-02 10:23:39 +0300
committerSamuli Piippo <samuli.piippo@digia.com>2014-09-02 10:24:26 +0300
commit406db8fabcf8de5ab31880ca579edb7004cc4f4e (patch)
tree6b349020fef1d2f8f601a509d7c259fa40bea0f9 /basicsuite/sensors/Light.qml
parent2aab20bb2c32aadba2bef16828e3dd0f6c29a30b (diff)
parentad9ea42d493bc9b125c019373fa5fe84cfcc225d (diff)
Merge remote-tracking branch 'origin/stable' into dev
* origin/stable: (63 commits) Doc: Bump version to 3.1.1 Make FPS checkbox persistent Handle accelerometer readings in rotated items webengine: Add slight delay before loading the start page webengine: disable the webgl demo Update screenshot of the Virtual Keyboard demo [Doc] Use symbolic links for demo preview images Changed the audio track on the Qt_EnterpriseEmbedded_1080p.mp4 video. Fix demo descriptions. launchersettings: make ip field span two columns Remove deleted demos also from doc Update all VirtualKeyboard import to version 1.1 Doc: Bump version to 3.1.0 Doc: Content/language improvement for About QtEE demo. Disable GraphicalEffects demo on beagleboneblack about: fit text properly to the box Fix Meet Qt Enterprise Embedded video url on startup Fix a typo in the new About presentation About Boot to Qt-demo update Update Enterprise gallery demo description ... Change-Id: I928ab65867993c83ae645834430fd15825349fde
Diffstat (limited to 'basicsuite/sensors/Light.qml')
-rw-r--r--basicsuite/sensors/Light.qml77
1 files changed, 37 insertions, 40 deletions
diff --git a/basicsuite/sensors/Light.qml b/basicsuite/sensors/Light.qml
index f997efd..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
- }
+ LightSensor {
+ active: true
+ onReadingChanged: {
+ illuminanceLevel.text = "Illuminance: " + reading.illuminance.toFixed(2);
}
}
}