diff --git a/GradientButton.qml b/GradientButton.qml
new file mode 100644
index 0000000..af2902d
--- /dev/null
+++ b/GradientButton.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import QtQuick.Controls.Material 2.2
+
+Rectangle {
+ id: root
+
+ signal clicked()
+
+ Gradient {
+ id: pressedGradient
+
+ GradientStop {position: 0.0; color: Material.color(Material.Grey, Material.Shade300)}
+ GradientStop {position: 0.5; color: Material.color(Material.BlueGrey, Material.Shade300)}
+ GradientStop {position: 1.0; color: Material.color(Material.Brown, Material.Shade300)}
+ }
+
+ Gradient {
+ id: normalGradient
+
+ GradientStop {position: 0.0; color: Material.color(Material.Grey)}
+ GradientStop {position: 0.5; color: Material.color(Material.BlueGrey)}
+ GradientStop {position: 1.0; color: Material.color(Material.Brown)}
+ }
+
+ MouseArea {
+ id: ma
+
+ anchors.fill: parent
+ }
+
+ gradient: ma.pressed ? pressedGradient : normalGradient
+}
diff --git a/HomeForm.qml b/HomeForm.qml
index ba72a28..f43d794 100644
--- a/HomeForm.qml
+++ b/HomeForm.qml
@@ -14,6 +14,7 @@ Page {
ListView {
anchors.fill: parent
+ anchors.margins: 5
model: lightsModel
spacing: 5
@@ -23,6 +24,7 @@ Page {
height: childrenRect.height
title: groupName || ""
+ lights: channels
}
}
}
diff --git a/LightGroup.qml b/LightGroup.qml
index 02e2be6..465a67b 100644
--- a/LightGroup.qml
+++ b/LightGroup.qml
@@ -5,17 +5,45 @@ Item {
id: root
property string title: ""
- property var lights: []
+ property QtObject lights: undefined
- Rectangle {
- width: parent.width
- height: 20
+ Column {
+ width: root.width
- color: "green"
+ spacing: 5
- Label {
- text: root.title
- anchors.centerIn: parent
+ GradientButton {
+ width: root.width
+ height: 40
+
+ visible: Boolean(root.title)
+ radius: 5
+
+ Label {
+ text: root.title
+ anchors.centerIn: parent
+ }
+ }
+
+ Row {
+ id: buttonsRow
+
+ width: root.width
+ height: childrenRect.height
+
+ spacing: 5
+
+ Repeater {
+ model: root.lights
+
+ width: root.width
+
+ GradientButton {
+ width: (root.width - buttonsRow.spacing * (root.lights.count - 1)) / root.lights.count
+ height: width / 2
+ radius: 5
+ }
+ }
}
}
}
diff --git a/qml.qrc b/qml.qrc
index ff00483..f6d169e 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -8,5 +8,6 @@
SubtitledItemDelegate.qml
LightsModel.qml
LightGroup.qml
+ GradientButton.qml
diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf
index 613ab74..5a7d1ec 100644
--- a/qtquickcontrols2.conf
+++ b/qtquickcontrols2.conf
@@ -7,7 +7,7 @@ Style=Material
[Material]
Theme=Dark
-Primary=#3C3C3C
-Accent=BlueGrey
+Primary=BlueGrey
+Accent=Grey
;Foreground=Brown
;Background=Steel