blob: a1680a97b5263aade17ab10b7a9ba20598ed542d (
plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick 2.10
import QtQuick.Templates 2.1 as T
import SideMenu 1.0
T.Button {
id: control
width: 180
height: 70
font: Constants.font
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
leftPadding: 4
rightPadding: 4
text: control.state
property alias text1Text: text1.text
autoExclusive: false
checkable: true
Image {
id: background
x: 15
y: 17
source: "assets/inactive_button.png"
}
Image {
id: contentItem
x: -1
y: 0
visible: true
source: "assets/hover_button.png"
}
Image {
id: image2
x: 0
y: -1
visible: true
source: "assets/active_button.png"
}
Text {
id: text1
x: -1
y: 16
width: 163
height: 16
color: "#ffffff"
text: "PRESSED"
horizontalAlignment: Text.AlignHCenter
font.weight: Font.ExtraLight
font.family: "IBM Plex Sans"
font.pixelSize: 12
}
states: [
State {
name: "checked"
when: control.checked
PropertyChanges {
target: background
x: 16
y: 16
width: 156
visible: false
}
PropertyChanges {
target: contentItem
visible: false
}
PropertyChanges {
target: image2
x: 0
y: 0
visible: true
}
PropertyChanges {
target: text1
x: 0
y: 16
width: 162
height: 16
text: "CHECKED"
horizontalAlignment: Text.AlignHCenter
}
},
State {
name: "hover"
when: control.hovered && !control.checked && !control.pressed
PropertyChanges {
target: image2
x: 0
visible: false
}
PropertyChanges {
target: background
x: 16
y: 16
visible: false
}
PropertyChanges {
target: contentItem
visible: true
}
PropertyChanges {
target: text1
x: -1
y: 16
width: 162
height: 16
color: "#d07533"
text: "HOVER"
horizontalAlignment: Text.AlignHCenter
}
},
State {
name: "normal"
when: !control.pressed && !control.checked &&!control.hovered
PropertyChanges {
target: image2
visible: false
}
PropertyChanges {
target: contentItem
visible: false
}
PropertyChanges {
target: background
visible: true
}
PropertyChanges {
target: text1
x: 15
y: 33
width: 163
height: 16
color: "#d07533"
text: "NORMAL"
horizontalAlignment: Text.AlignHCenter
}
}
]
}
|