@@ -7,82 +7,103 @@ import ComponentLibrary
7
7
T .Popup {
8
8
id: actionMenu
9
9
10
- implicitWidth: 200
11
- implicitHeight: contentColumn .height
10
+ width: appWindow .width
11
+ height: actualHeight
12
+
13
+ y: appWindow .height - actualHeight
12
14
13
15
padding: 0
14
16
margins: 0
15
17
16
18
modal: true
17
- dim: false
18
- focus: isMobile
19
+ dim: true
20
+ focus: appWindow . isMobile
19
21
closePolicy: T .Popup .CloseOnEscape | T .Popup .CloseOnPressOutside
20
- parent: Overlay .overlay
22
+ parent: T .Overlay .overlay
23
+
24
+ signal menuSelected (var index)
21
25
22
- property bool partonevisible: (actionUpdate .visible || actionRealtime .visible )
23
- property bool parttwovisible: (actionHistoryRefresh .visible || actionHistoryClear .visible )
24
- property bool partthreevisible: (actionLed .visible || actionWatering .visible || actionGraphMode .visible || actionShowSettings .visible )
26
+ // //////////////////////////////////////////////////////////////////////////
25
27
26
28
property int layoutDirection: Qt .RightToLeft
27
29
28
- signal menuSelected (var index)
30
+ property int actualHeight: {
31
+ if (typeof mobileMenu !== " undefined" && mobileMenu .height )
32
+ return contentColumn .height + appWindow .screenPaddingNavbar + appWindow .screenPaddingBottom
33
+ return contentColumn .height
34
+ }
29
35
30
- // //////////////////////////////////////////////////////////////////////////
36
+ property bool opening: false
37
+ property bool closing: false
31
38
32
- enter: Transition { NumberAnimation { property: " opacity" ; from: 0.0 ; to: 1.0 ; duration: 133 ; } }
33
- exit: Transition { NumberAnimation { property: " opacity" ; from: 1.0 ; to: 0.0 ; duration: 133 ; } }
39
+ onAboutToShow: {
40
+ opening = true
41
+ closing = false
42
+ }
43
+ onAboutToHide: {
44
+ opening = false
45
+ closing = true
46
+ }
34
47
35
48
// //////////////////////////////////////////////////////////////////////////
36
49
37
- background: Rectangle {
38
- color: Theme .colorBackground
39
- radius: Theme .componentRadius
40
- border .color : Theme .colorSeparator
41
- border .width : Theme .componentBorderWidth
50
+ enter: Transition { NumberAnimation { property: " opacity" ; from: 0.0 ; to: 1.0 ; duration: 233 ; } }
51
+ exit: Transition { NumberAnimation { property: " opacity" ; from: 1.0 ; to: 0.66 ; duration: 233 ; } }
52
+
53
+ T .Overlay .modal : Rectangle {
54
+ color: " #000"
55
+ opacity: Theme .isLight ? 0.24 : 0.48
42
56
}
43
57
58
+ background: Item { }
59
+
60
+ contentItem: Item { }
61
+
44
62
// //////////////////////////////////////////////////////////////////////////
45
63
46
- contentItem: Item {
47
- Column {
64
+ Rectangle {
65
+ id: actualPopup
66
+ anchors .left : parent .left
67
+ anchors .right : parent .right
68
+ anchors .bottom : parent .bottom
69
+
70
+ height: opening ? actionMenu .actualHeight : 0
71
+ Behavior on height { NumberAnimation { duration: 233 } }
72
+
73
+ color: Theme .colorComponentBackground
74
+
75
+ Rectangle { // separator
76
+ anchors .left : parent .left
77
+ anchors .right : parent .right
78
+ height: Theme .componentBorderWidth
79
+ color: Theme .colorSeparator
80
+ }
81
+
82
+ Column { // content
48
83
id: contentColumn
84
+ anchors .top : parent .top
85
+ anchors .topMargin : 0
49
86
anchors .left : parent .left
87
+ anchors .leftMargin : screenPaddingLeft
50
88
anchors .right : parent .right
89
+ anchors .rightMargin : screenPaddingRight
51
90
52
- topPadding: 8
91
+ topPadding: Theme . componentMargin
53
92
bottomPadding: 8
54
93
spacing: 4
55
94
56
- // //////
57
-
58
- ActionMenuItem {
59
- id: actionClose
60
-
61
- index: - 1
62
- text: qsTr (" Close" )
63
- source: " qrc:/IconLibrary/material-symbols/close.svg"
64
- layoutDirection: actionMenu .layoutDirection
65
- opacity: 0.8
66
-
67
- onClicked: {
68
- close ()
69
- }
70
- }
71
-
72
- ListSeparatorPadded {
73
- anchors .leftMargin : Theme .componentMargin
74
- anchors .rightMargin : Theme .componentMargin
75
- height: 9
76
- }
95
+ property bool partonevisible: (actionUpdate .visible || actionRealtime .visible )
96
+ property bool parttwovisible: (actionHistoryRefresh .visible || actionHistoryClear .visible )
97
+ property bool partthreevisible: (actionLed .visible || actionWatering .visible || actionGraphMode .visible || actionShowSettings .visible )
77
98
78
99
// //////
79
100
80
101
ActionMenuItem {
81
102
id: actionUpdate
82
103
anchors .left : parent .left
83
104
anchors .right : parent .right
105
+ index: 1
84
106
85
- index: 0
86
107
text: qsTr (" Update data" )
87
108
source: " qrc:/IconLibrary/material-symbols/refresh.svg"
88
109
layoutDirection: actionMenu .layoutDirection
@@ -97,8 +118,8 @@ T.Popup {
97
118
98
119
ActionMenuItem {
99
120
id: actionRealtime
121
+ index: 2
100
122
101
- index: 1
102
123
text: qsTr (" Real time data" )
103
124
source: " qrc:/IconLibrary/material-icons/duotone/update.svg"
104
125
layoutDirection: actionMenu .layoutDirection
@@ -122,8 +143,8 @@ T.Popup {
122
143
123
144
ActionMenuItem {
124
145
id: actionHistoryRefresh
146
+ index: 3
125
147
126
- index: 2
127
148
text: qsTr (" Update history" )
128
149
source: " qrc:/IconLibrary/material-icons/duotone/date_range.svg"
129
150
layoutDirection: actionMenu .layoutDirection
@@ -138,8 +159,8 @@ T.Popup {
138
159
139
160
ActionMenuItem {
140
161
id: actionHistoryClear
162
+ index: 4
141
163
142
- index: 3
143
164
text: qsTr (" Clear history" )
144
165
source: " qrc:/IconLibrary/material-icons/duotone/date_clear.svg"
145
166
layoutDirection: actionMenu .layoutDirection
@@ -163,8 +184,8 @@ T.Popup {
163
184
164
185
ActionMenuItem {
165
186
id: actionLed
166
-
167
187
index: 8
188
+
168
189
text: qsTr (" Blink LED" )
169
190
source: " qrc:/IconLibrary/material-icons/duotone/emoji_objects.svg"
170
191
layoutDirection: actionMenu .layoutDirection
@@ -179,8 +200,8 @@ T.Popup {
179
200
180
201
ActionMenuItem {
181
202
id: actionWatering
182
-
183
203
index: 9
204
+
184
205
text: qsTr (" Watering" )
185
206
source: " qrc:/IconLibrary/material-icons/duotone/local_drink.svg"
186
207
layoutDirection: actionMenu .layoutDirection
@@ -195,8 +216,8 @@ T.Popup {
195
216
196
217
ActionMenuItem {
197
218
id: actionCalibrate
198
-
199
219
index: 10
220
+
200
221
text: qsTr (" Calibrate sensor" )
201
222
source: " qrc:/IconLibrary/material-icons/duotone/model_training.svg"
202
223
layoutDirection: actionMenu .layoutDirection
@@ -211,8 +232,8 @@ T.Popup {
211
232
212
233
ActionMenuItem {
213
234
id: actionGraphMode
214
-
215
235
index: 16
236
+
216
237
text: qsTr (" Switch graph" )
217
238
layoutDirection: actionMenu .layoutDirection
218
239
visible: (appContent .state === " DeviceThermometer" )
@@ -230,8 +251,8 @@ T.Popup {
230
251
231
252
ActionMenuItem {
232
253
id: actionShowSettings
233
-
234
254
index: 17
255
+
235
256
text: qsTr (" Sensor infos" )
236
257
source: " qrc:/IconLibrary/material-icons/duotone/memory.svg"
237
258
layoutDirection: actionMenu .layoutDirection
@@ -246,8 +267,8 @@ T.Popup {
246
267
247
268
ActionMenuItem {
248
269
id: actionReboot
249
-
250
270
index: 32
271
+
251
272
text: qsTr (" Reboot sensor" )
252
273
source: " qrc:/IconLibrary/material-symbols/refresh.svg"
253
274
layoutDirection: actionMenu .layoutDirection
@@ -259,6 +280,8 @@ T.Popup {
259
280
close ()
260
281
}
261
282
}
283
+
284
+ // //////
262
285
}
263
286
}
264
287
0 commit comments