File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import QtQuick 2.15
6
6
import QtQuick.Controls 2.15
7
7
8
8
Button {
9
+ id: root
9
10
font .family : " Inter"
10
11
font .styleName : " Semi Bold"
11
12
font .pixelSize : 18
@@ -17,9 +18,47 @@ Button {
17
18
verticalAlignment: Text .AlignVCenter
18
19
}
19
20
background: Rectangle {
21
+ id: bg
20
22
implicitHeight: 46
21
23
implicitWidth: 300
22
24
color: Theme .color .orange
23
25
radius: 5
26
+ state: " DEFAULT"
27
+
28
+ states: [
29
+ State {
30
+ name: " DEFAULT"
31
+ PropertyChanges { target: bg; color: Theme .color .orange }
32
+ },
33
+ State {
34
+ name: " HOVER"
35
+ PropertyChanges { target: bg; color: Theme .color .orangeLight1 }
36
+ },
37
+ State {
38
+ name: " PRESSED"
39
+ PropertyChanges { target: bg; color: Theme .color .orangeLight2 }
40
+ }
41
+ ]
42
+
43
+ Behavior on color {
44
+ ColorAnimation { duration: 150 }
45
+ }
46
+ }
47
+ MouseArea {
48
+ anchors .fill : parent
49
+ hoverEnabled: true
50
+ onEntered: {
51
+ root .background .state = " HOVER"
52
+ }
53
+ onExited: {
54
+ root .background .state = " DEFAULT"
55
+ }
56
+ onPressed: {
57
+ root .background .state = " PRESSED"
58
+ }
59
+ onReleased: {
60
+ root .background .state = " DEFAULT"
61
+ root .clicked ()
62
+ }
24
63
}
25
64
}
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ Control {
11
11
required property color white
12
12
required property color background
13
13
required property color orange
14
+ required property color orangeLight1
15
+ required property color orangeLight2
14
16
required property color red
15
17
required property color green
16
18
required property color blue
@@ -38,6 +40,8 @@ Control {
38
40
white: " #FFFFFF"
39
41
background: " black"
40
42
orange: " #F89B2A"
43
+ orangeLight1: " #FFAD4A"
44
+ orangeLight2: " #FFBF72"
41
45
red: " #EC6363"
42
46
green: " #36B46B"
43
47
blue: " #3CA3DE"
@@ -59,6 +63,8 @@ Control {
59
63
white: " #FFFFFF"
60
64
background: " white"
61
65
orange: " #F7931A"
66
+ orangeLight1: " #FFAD4A"
67
+ orangeLight2: " #FFBF72"
62
68
red: " #EB5757"
63
69
green: " #27AE60"
64
70
blue: " #2D9CDB"
You can’t perform that action at this time.
0 commit comments