Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.5
- import Sailfish.Silica 1.0
- import QtSensors 5.2
- Page {
- AmbientLightSensor {
- id: ambientSensor
- active: true
- }
- LightSensor {
- id: lightSensor
- active: true
- }
- PageHeader { title: qsTr("Light Sensors") }
- Switch {
- property real scaleFactor: {
- if (!ambientSensor.reading) return 1.0;
- return ambientSensor.reading.lightLevel / 5;
- }
- anchors.centerIn: parent
- enabled: ambientSensor.active
- checked: ambientSensor.reading &&
- (ambientSensor.reading.lightLevel !==
- AmbientLightReading.Undefined)
- automaticCheck: false
- scale: Math.min(parent.width, parent.height) *
- scaleFactor / Theme.iconSizeSmall
- }
- Label {
- anchors.centerIn: parent
- text: lightSensor.reading ?
- lightSensor.reading.illuminance : " "
- color: Theme.highlightColor
- font.bold: true
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement