diff options
author | Titta Heikkala <titta.heikkala@qt.io> | 2017-02-21 13:03:54 +0200 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-02-22 10:31:51 +0000 |
commit | 1bcaaef7d3a30a7bad37b717d0fcad4ba8a27e95 (patch) | |
tree | 16a77fb2311c154a84f80b16bf565687b06069c8 /tradeshow/iot-sensortag/resources/base/LightChart.qml | |
parent | a7f7d382d83bc7e28c770bfeb010a3e8ef43b375 (diff) |
iot-sensortag: Clean up onSensorChanged signal handlers
Removed onSensorChanged signal handlers from charts as they are
not needed. Instead, react to changes of sensor properties.
Change-Id: Ib848d3ddfeed550538d35793b24eeb137a57a171
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'tradeshow/iot-sensortag/resources/base/LightChart.qml')
-rw-r--r-- | tradeshow/iot-sensortag/resources/base/LightChart.qml | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/tradeshow/iot-sensortag/resources/base/LightChart.qml b/tradeshow/iot-sensortag/resources/base/LightChart.qml index f170e81..a51787d 100644 --- a/tradeshow/iot-sensortag/resources/base/LightChart.qml +++ b/tradeshow/iot-sensortag/resources/base/LightChart.qml @@ -57,10 +57,6 @@ BaseChart { title: qsTr("Light Intensity") rightSide: true - onSensorChanged: if (sensor) { - sensor.lightIntensityChanged.connect(contentItem.getLightText) - } - content: Item { id: container @@ -68,21 +64,18 @@ BaseChart { property alias lightText: lightMainText.text property alias lightImg: brightnessImg - property real lightValue: 0 + property real lightValue: sensor ? sensor.lightIntensityLux : 0 property real maxLightValue: 1 property real normalizedLightValue: 0 - function getLightText() - { - lightValue = sensor.lightIntensityLux; - contentItem.lightText = lightValue.toFixed(1); + onLightValueChanged: { + contentItem.lightText = lightValue.toFixed(1) if (lightValue > maxLightValue) - { - maxLightValue = lightValue; - } - normalizedLightValue = lightValue / maxLightValue; - lightImg.opacity = normalizedLightValue; + maxLightValue = lightValue + + normalizedLightValue = lightValue / maxLightValue + lightImg.opacity = normalizedLightValue } Image { |