summaryrefslogtreecommitdiffstats
path: root/app/HVAC.qml
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-13 12:22:08 +0900
committerTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-13 23:42:32 +0900
commit1252fdb973f7ba815017447c1a3ed49852de0597 (patch)
tree50d5cda4cee0cf793a5ff72b20b266178ae08670 /app/HVAC.qml
parent560062626becb4d211a9948bf3008921129711cf (diff)
add binding initial code in qml
Change-Id: I0efeb67ff2659a0a01be116ab59947db77ec6574 Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Diffstat (limited to 'app/HVAC.qml')
-rw-r--r--app/HVAC.qml15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/HVAC.qml b/app/HVAC.qml
index 565b108..f5cd76b 100644
--- a/app/HVAC.qml
+++ b/app/HVAC.qml
@@ -18,10 +18,17 @@ import QtQuick 2.6
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import AGL.Demo.Controls 1.0
+import 'api' as API
ApplicationWindow {
id: root
+ API.Binding {
+ id: binding
+ url: bindingAddress
+ onFanSpeedChanged: fanSpeedSlider.value = fanSpeed
+ }
+
ColumnLayout {
anchors.fill: parent
anchors.topMargin: width / 10
@@ -35,17 +42,17 @@ ApplicationWindow {
Item {
width: root.width * 0.8
Slider {
- id: fanSpeed
+ id: fanSpeedSlider
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
onValueChanged: {
- console.debug('Fan', value)
+ binding.fanSpeed = value
}
}
Label {
- anchors.left: fanSpeed.left
- anchors.top: fanSpeed.bottom
+ anchors.left: fanSpeedSlider.left
+ anchors.top: fanSpeedSlider.bottom
font.pixelSize: 32
text: 'FAN SPEED'
}