-
Notifications
You must be signed in to change notification settings - Fork 2
/
BtnSlim.qml
81 lines (71 loc) · 2.05 KB
/
BtnSlim.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import QtQuick 2.12
import QtGraphicalEffects 1.0
Item {
property string btnLabel: ""
property bool btnLight: true
property bool btnDisable : false
property int btnSize: 15
width: textMetrics.width * 1.4
height: textMetrics.height * 1.2
TextMetrics {
id: textMetrics
font {
family: "Segoe UI"
weight: Font.DemiBold
pixelSize: btnSize
}
text: btnLabel
}
Rectangle {
anchors.fill: parent
color: "transparent"
Rectangle {
anchors.centerIn: parent
width: parent.width - 2
height: parent.height - 2
color: "#0f1418"
radius: height * 0.5
opacity: 0.1
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: -3
verticalOffset: -3
samples: 25
color: "white"
}
}
Rectangle {
anchors.centerIn: parent
width: parent.width - 2
height: parent.height - 2
radius: height * 0.5
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 4
verticalOffset: 4
samples: 25
}
}
Rectangle {
id: rect
anchors.centerIn: parent
width: parent.height
height: parent.width
radius: width * 0.5
rotation: -90
gradient: Gradient {
GradientStop { position: 0.0; color: btnLight ? "#0B6AAC" : "#2E3238" }
GradientStop { position: 1.0; color: btnLight ? "#1A87C9" : "#1A1D21" }
}
}
Text {
anchors.centerIn: parent
text : textMetrics.text
verticalAlignment: Text.AlignVCenter
font : textMetrics.font
color: btnDisable ? "#7F7F80" : "#ffffff"
}
}
}