Добавил кнопку с градиентом
This commit is contained in:
32
GradientButton.qml
Normal file
32
GradientButton.qml
Normal file
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
qml.qrc
1
qml.qrc
@@ -8,5 +8,6 @@
|
||||
<file>SubtitledItemDelegate.qml</file>
|
||||
<file>LightsModel.qml</file>
|
||||
<file>LightGroup.qml</file>
|
||||
<file>GradientButton.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -7,7 +7,7 @@ Style=Material
|
||||
|
||||
[Material]
|
||||
Theme=Dark
|
||||
Primary=#3C3C3C
|
||||
Accent=BlueGrey
|
||||
Primary=BlueGrey
|
||||
Accent=Grey
|
||||
;Foreground=Brown
|
||||
;Background=Steel
|
||||
|
||||
Reference in New Issue
Block a user