File tree Expand file tree Collapse file tree 1 file changed +44
-4
lines changed Expand file tree Collapse file tree 1 file changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,32 @@ AbstractButton {
14
14
property url iconSource: " "
15
15
16
16
padding: 0
17
- background: null
17
+ background: Rectangle {
18
+ id: bg
19
+ height: root .height
20
+ width: root .width
21
+ radius: 5
22
+ state: " DEFAULT"
23
+
24
+ states: [
25
+ State {
26
+ name: " DEFAULT"
27
+ PropertyChanges { target: bg; color: Theme .color .background }
28
+ },
29
+ State {
30
+ name: " HOVER"
31
+ PropertyChanges { target: bg; color: Theme .color .neutral2 }
32
+ },
33
+ State {
34
+ name: " PRESSED"
35
+ PropertyChanges { target: bg; color: Theme .color .neutral3 }
36
+ }
37
+ ]
38
+
39
+ Behavior on color {
40
+ ColorAnimation { duration: 150 }
41
+ }
42
+ }
18
43
contentItem: RowLayout {
19
44
anchors .fill : parent
20
45
spacing: 0
@@ -33,7 +58,6 @@ AbstractButton {
33
58
icon .height : root .iconHeight
34
59
icon .width : root .iconWidth
35
60
background: null
36
- onClicked: root .clicked ()
37
61
}
38
62
}
39
63
Loader {
@@ -52,8 +76,24 @@ AbstractButton {
52
76
color: Theme .color .neutral9
53
77
text: root .text
54
78
}
55
- onClicked: root .clicked ()
56
79
}
57
- }
80
+ }
81
+ }
82
+ MouseArea {
83
+ anchors .fill : parent
84
+ hoverEnabled: true
85
+ onEntered: {
86
+ root .background .state = " HOVER"
87
+ }
88
+ onExited: {
89
+ root .background .state = " DEFAULT"
90
+ }
91
+ onPressed: {
92
+ root .background .state = " PRESSED"
93
+ }
94
+ onReleased: {
95
+ root .background .state = " DEFAULT"
96
+ root .clicked ()
97
+ }
58
98
}
59
99
}
You can’t perform that action at this time.
0 commit comments