-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathExample_1.qml
More file actions
505 lines (444 loc) · 13.8 KB
/
Example_1.qml
File metadata and controls
505 lines (444 loc) · 13.8 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.11
import org.deepin.dtk 1.0
Item {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: function(mouse) {
if (mouse.button === Qt.RightButton)
contextMenu.popup()
}
onPressAndHold: function(mouse) {
if (mouse.source === Qt.MouseEventNotSynthesized)
contextMenu.popup()
}
Menu {
id: contextMenu
MenuItem {
text: "Cut"
icon.name: "edit-cut"
display: AbstractButton.TextBesideIcon
}
MenuItem {
text: "Copy"
icon.name: "edit-copy"
display: IconLabel.IconBesideText
}
MenuItem {
text: "Paste"
checkable: true
checked: true
}
MenuSeparator { }
Menu {
title: "Find/Replace"
Action { text: "Find Next" }
Action { text: "Find Previous" }
Action { text: "Replace" }
}
MenuItem { text: "Exit" }
}
}
Label {
id: btnLabel
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 20
height: btn.height
text: qsTr("Button:")
verticalAlignment: Text.AlignVCenter
}
Button {
id: btn
anchors.left: btnLabel.right
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 20
text: "Button"
}
WarningButton {
id: warningBtn
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
anchors.left: btn.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
text: "Warning" // @disable-check M16
onPressed: console.log("WarningButton pressed") // @disable-check M16
}
RecommandButton {
id: highlightedionBtn
anchors.left: warningBtn.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
text: "Recommand" // @disable-check M16
}
ToolButton {
id: toolButton
anchors.left: highlightedionBtn.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
}
IconButton {
id: iconButton
width: 36 // @disable-check M16
anchors.left: toolButton.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
icon.name: "org.deepin.Example/test/action_add"
}
IconButton {
id: iconButton1
width: 36 // @disable-check M16
anchors.left: iconButton.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
icon.name: "test/action_add" // @disable-check M16
}
IconButton {
id: iconButton2
width: 36 // @disable-check M16
anchors.left: iconButton1.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
flat: true // @disable-check M16
icon.name: "action_add" // @disable-check M16
}
FloatingButton {
id: floatingButton
width: 36 // @disable-check M16
anchors.left: iconButton2.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
icon.name: "action_add"
}
DelayButton {
id: dlyBtn
anchors.left: floatingButton.right
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 20
text: "DelayButton"
NumberAnimation on progress {
from: 0
to: 1.0
duration: 4000
loops: Animation.Infinite
}
}
RoundButton {
id: roundButton;
anchors.top: parent.top
anchors.left: dlyBtn.right
anchors.leftMargin: 20
anchors.topMargin: 20
icon.name: "action_add"
}
ButtonBox {
id: buttonBox
anchors.left: roundButton.right // @disable-check M16
anchors.leftMargin: 20 // @disable-check M16
anchors.top: parent.top // @disable-check M16
anchors.topMargin: 20 // @disable-check M16
ToolButton {
checkable: true; icon.name: "go-previous"; checked: true // @disable-check M16
}
ToolButton {
checkable: true; icon.name: "go-down" // @disable-check M16
}
ToolButton {
checkable: true; icon.name: "go-next" // @disable-check M16
}
}
LineEdit {
id: lineEdit
anchors.left: parent.left
anchors.top: btnLabel.bottom
anchors.topMargin: 20
text: "Testing the alert message in line edit."
alertText: qsTr("This is a long sentence.")
alertDuration: 2000 // millisecond
showAlert: focus
}
SearchEdit {
id: searcherEdit
anchors.left: lineEdit.right
anchors.top: lineEdit.top
anchors.leftMargin: 20
}
SpinBox {
id: spinBox
anchors.left: searcherEdit.right
anchors.top: searcherEdit.top
anchors.leftMargin: 20
editable: true
alertText: qsTr("This is a long sentence.")
alertDuration: 2000 // millisecond
showAlert: focus
}
SpinBox {
id: customSpinBox
anchors.left: spinBox.right
anchors.top: spinBox.bottom
anchors.leftMargin: 20
editable: true
value: 1
up.indicator: Rectangle {
border.color: "green"
anchors.right: customSpinBox.right
anchors.rightMargin: 5
width: 20
height: 15
}
}
PlusMinusSpinBox {
id: plusMinusSpinBox
anchors.left: spinBox.right
anchors.top: spinBox.top
anchors.leftMargin: 20
spinBox.editable: true
spinBox.alertText: qsTr("Only numbers can be entered.")
spinBox.alertDuration: 2000 // millisecond
spinBox.showAlert: focus
}
ListView {
model: 5
implicitHeight: 250
delegate: CheckDelegate {
text: index;
icon.name: "action_add"
}
anchors.top: btnLabel.bottom
anchors.left: plusMinusSpinBox.right
anchors.topMargin: 20
anchors.leftMargin: 20
}
Row {
id: sliderRow
anchors {
top: lineEdit.bottom
topMargin: 20
}
spacing: 10
height: 350
Slider {
highlightedPassedGroove: true
orientation: Qt.Vertical
height: parent.height
handleType: Slider.HandleType.NoArrowVertical
}
Slider {
height: parent.height
orientation: Qt.Vertical
handleType: Slider.HandleType.ArrowLeft
}
Slider {
height: parent.height
highlightedPassedGroove: true
orientation: Qt.Vertical
handleType: Slider.HandleType.ArrowRight
}
}
Column {
id: sliderColum
anchors {
top: lineEdit.bottom
topMargin: 40
left: sliderRow.right
leftMargin: 60
}
spacing: 10
width: 400
Slider {
highlightedPassedGroove: true
width: parent.width
}
Slider {
width: parent.width
handleType: Slider.HandleType.ArrowBottom
}
Slider {
width: parent.width
highlightedPassedGroove: true
handleType: Slider.HandleType.ArrowUp
}
TipsSlider {
width: parent.width
tickDirection: TipsSlider.TickDirection.Back
slider.highlightedPassedGroove: true
slider.handleType: Slider.HandleType.ArrowBottom
ticks: [SliderTipItem {
},
SliderTipItem {
},
SliderTipItem {
},
SliderTipItem {
}]
}
TipsSlider {
id: sliderTickTip2
readonly property var tips: [qsTr("Fast"), qsTr("Slow")]
width: parent.width
tickDirection: TipsSlider.TickDirection.Back
slider.handleType: Slider.HandleType.ArrowBottom
ticks: [SliderTipItem {
text: sliderTickTip2.tips[0]
},
SliderTipItem {
text: sliderTickTip2.tips[1]
}]
// test highlight Text
HighlightPanel {
id: __highlight
readonly property real highlightMargin: 20
anchors.bottom: parent.bottom
x: parent.slider.value * (parent.width - parent.slider.handle.width) - width / 2
+ parent.slider.handle.width / 2
width: __text.implicitWidth
height: __text.implicitHeight
Text {
id: __text
text: sliderTickTip2.tips[0]
color: palette.highlightedText
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
}
TipsSlider {
id: sliderTickTip3
readonly property var tips: [qsTr("1m"), qsTr("5m"), qsTr("10m"), qsTr("15m"), qsTr("30m"), qsTr("1h"), qsTr("Never")]
width: parent.width
tickDirection: TipsSlider.TickDirection.Back
slider.handleType: Slider.HandleType.ArrowBottom
slider.stepSize: 10
slider.from: 0
slider.to: 60
ticks: [SliderTipItem {
text: sliderTickTip3.tips[0]
textHorizontalAlignment: Text.AlignLeft
},
SliderTipItem {
text: sliderTickTip3.tips[1]
},
SliderTipItem {
text: sliderTickTip3.tips[2]
},
SliderTipItem {
text: sliderTickTip3.tips[3]
},
SliderTipItem {
text: sliderTickTip3.tips[4]
},
SliderTipItem {
text: sliderTickTip3.tips[5]
},
SliderTipItem {
text: sliderTickTip3.tips[6]
textHorizontalAlignment: Text.AlignRight
}]
// test end Indicator
Rectangle {
width: 30
height: 30
color: "blue"
anchors {
left: parent.right
leftMargin: 20
verticalCenter: parent.slider.verticalCenter
}
Text {
anchors.centerIn: parent
text: sliderTickTip3.slider.value.toFixed(1)
color: "white"
}
}
// test start Indicator
Rectangle {
width: 30
height: 30
color: "red"
anchors {
right: parent.left
rightMargin: 20
verticalCenter: parent.slider.verticalCenter
}
Text {
anchors.centerIn: parent
text: "S"
color: "white"
}
}
}
}
Row {
id: switchBtnRow
anchors {
top: sliderColum.bottom
left: sliderRow.right
topMargin: 30
leftMargin: 40
}
spacing: 10
Switch {
checked: true
}
Switch {
}
Switch {
checked: true
enabled: false
}
Switch {
enabled: false
}
}
Row {
anchors {
top: sliderColum.bottom
left: switchBtnRow.right
topMargin: 30
leftMargin: 20
}
spacing: 10
ComboBox {
id: nonEditComboBox
model: ["Banana", "Apple", "Coconut"]
}
ComboBox {
id: editableComboBox
editable: true
model: ["Banana", "Apple", "Coconut"]
}
ComboBox {
id: nonEditComboBoxWithIcon
textRole: "text"
iconNameRole: "icon"
model: ListModel {
ListElement { text: "Banana"; icon: "go-previous" }
ListElement { text: "Apple"; icon: "go-down" }
ListElement { text: "Coconut"; icon: "go-next" }
}
}
ComboBox {
id: editableComboBoxWithIcon
editable: true
textRole: "text"
iconNameRole: "icon"
model: ListModel {
ListElement { text: "Banana"; icon: "go-previous" }
ListElement { text: "Apple"; icon: "go-down" }
ListElement { text: "Coconut"; icon: "go-next" }
}
}
}
}