-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLedButtonForm.ui.qml
55 lines (51 loc) · 1.32 KB
/
LedButtonForm.ui.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import QtQuick 2.4
import QtQuick.Controls 2.2
Item {
id: button
width: 10
height: 10
anchors.top: parent.top
anchors.left: parent.left
property alias buttonText: innerText.text;
property color color: "white"
property color hoverColor: "#aaaaaa"
property color pressColor: "slategray"
property int fontSize: 10
property int borderWidth: 1
scale: state === "Pressed" ? 0.96 : 1.0
onEnabledChanged: state = ""
signal clicked
signal chosen(Item thisled)
//Rectangle to draw the button
Rectangle {
id: rectangleButton
anchors.fill: parent
radius: width
color: button.enabled ? button.color : "grey"
border.width: borderWidth
border.color: "black"
Text {
id: innerText
font.pointSize: fontSize
anchors.centerIn: parent
}
}
//change the color of the button in differen button states
states: [
State {
name: "Hovering"
PropertyChanges {
target: rectangleButton
//opacity: 0.8
color: hoverColor
}
},
State {
name: "Pressed"
PropertyChanges {
target: rectangleButton
color: pressColor
}
}
]
}