-
Notifications
You must be signed in to change notification settings - Fork 0
/
Button.qml
45 lines (36 loc) · 865 Bytes
/
Button.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
import QtQuick 2.12
Rectangle {
id: root
property alias text: label.text
signal clicked
state: "RELEASED"
width: view.cellHeight * 1.5
height: view.cellHeight / 2
radius: root.width / 2
anchors.centerIn: parent
border {
color: "#B66C2D"
width: 2
}
Text {
id: label
anchors.centerIn: parent
text: "Text"
}
MouseArea {
anchors.fill: parent
onPressed: root.state = "PRESSED"
onReleased: root.state = "RELEASED"
onClicked: root.clicked()
}
states: [
State {
name: "PRESSED"
PropertyChanges { target: root; color: "#E79959"}
},
State {
name: "RELEASED"
PropertyChanges { target: root; color: "#DF863D"}
}
]
}