-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.qml
619 lines (555 loc) · 16.8 KB
/
main.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
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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
import QtQuick 2.15
import CustomControls 1.0
import QtQuick.Window 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5
ApplicationWindow {
width: 1920
height: 960
visible: true
title: qsTr("Car DashBoard")
color: "#1E1E1E"
visibility: "FullScreen"
property int nextSpeed: 60
function generateRandom(maxLimit = 70){
let rand = Math.random() * maxLimit;
rand = Math.floor(rand);
return rand;
}
Timer{
repeat: true
interval: 3000
running: true
onTriggered: {
nextSpeed = generateRandom()
}
}
Timer{
id:speedTimer
repeat: true
interval: 500
running: true
onTriggered: {
var currentSpeed = speedLabel.text
if(nextSpeed > currentSpeed){
for(let i = currentSpeed; i< nextSpeed ;i++){
speedLabel.text = i
}
}else{
for(let j = nextSpeed; j< currentSpeed ;j++){
speedLabel.text = j
}
}
}
}
Shortcut {
sequence: StandardKey.Quit
context: Qt.ApplicationShortcut
onActivated: Qt.quit()
}
Image {
id: dashboard
width: parent.width
height: parent.height
anchors.centerIn: parent
source: "qrc:/assets/Dashboard.svg"
/*
Top Bar Of Screen
*/
Image {
id: topBar
width: 1357
height: 115
source: "qrc:/assets/Vector 70.svg"
anchors{
top: parent.top
topMargin: 26.50
horizontalCenter: parent.horizontalCenter
}
Image {
id: headLight
width: 42.5
height: 38.25
anchors{
top: parent.top
topMargin: 10
leftMargin: 230
left: parent.left
}
source: "qrc:/assets/Low beam headlights.svg"
}
Label{
text: "19:30"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.DemiBold
color: "#FFFFFF"
anchors.top: parent.top
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
}
Label{
text: "02/08/2022"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.DemiBold
color: "#FFFFFF"
anchors.right: parent.right
anchors.rightMargin: 230
anchors.top: parent.top
anchors.topMargin: 10
}
}
/*
Speed Label
*/
Label{
id:speedLabel
text: "68"
font.pixelSize: 134
font.family: "Inter"
color: "#01E6DE"
font.bold: Font.DemiBold
anchors.top: parent.top
anchors.topMargin:Math.floor(parent.height * 0.35)
anchors.horizontalCenter: parent.horizontalCenter
}
Label{
text: "MPH"
font.pixelSize: 46
font.family: "Inter"
color: "#01E6DE"
font.bold: Font.Normal
anchors.top:speedLabel.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
/*
Speed Limit Label
*/
Rectangle{
id:speedLimit
width: 130
height: 130
radius: height/2
color: "#D9D9D9"
border.color: "#CD0303"
border.width: 10
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 50
Label{
text: "70"
font.pixelSize: 52
font.family: "Inter"
font.bold: Font.Bold
color: "#171717"
anchors.centerIn: parent
}
}
Image {
anchors{
bottom: speedLimit.top
bottomMargin: 30
horizontalCenter:speedLimit.horizontalCenter
}
source: "qrc:/assets/car.png"
}
// IMGonline.com.ua ==> Compress Image With
/*
Left Road
*/
Image {
id: leftRoad
width: 127
height: 397
anchors{
left: speedLimit.left
leftMargin: 100
bottom: parent.bottom
bottomMargin: 26.50
}
source: "qrc:/assets/Vector 2.svg"
}
RowLayout{
spacing: 20
anchors{
left: parent.left
leftMargin: 250
bottom: parent.bottom
bottomMargin: 26.50 + 65
}
RowLayout{
spacing: 3
Label{
text: "100.6"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
color: "#FFFFFF"
}
Label{
text: "°F"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
opacity: 0.2
color: "#FFFFFF"
}
}
RowLayout{
spacing: 1
Layout.topMargin: 10
Rectangle{
width: 20
height: 15
color: "#32D74B"
}
Rectangle{
width: 20
height: 15
color: "#32D74B"
}
Rectangle{
width: 20
height: 15
color: "#32D74B"
}
Rectangle{
width: 20
height: 15
color: "#01E6DC"
}
Rectangle{
width: 20
height: 15
color: "#01E6DC"
}
Rectangle{
width: 20
height: 15
color: "#01E6DC"
}
Rectangle{
width: 20
height: 15
color: "#01E6DC"
}
}
Label{
text: "78mph"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
color: "#FFFFFF"
}
}
/*
Right Road
*/
Image {
id: rightRoad
width: 127
height: 397
anchors{
right: speedLimit.right
rightMargin: 100
bottom: parent.bottom
bottomMargin: 26.50
}
source: "qrc:/assets/Vector 1.svg"
}
/*
Right Side gear
*/
RowLayout{
spacing: 20
anchors{
right: parent.right
rightMargin: 350
bottom: parent.bottom
bottomMargin: 26.50 + 65
}
Label{
text: "Ready"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
color: "#32D74B"
}
Label{
text: "P"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
color: "#FFFFFF"
}
Label{
text: "R"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
opacity: 0.2
color: "#FFFFFF"
}
Label{
text: "N"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
opacity: 0.2
color: "#FFFFFF"
}
Label{
text: "D"
font.pixelSize: 32
font.family: "Inter"
font.bold: Font.Normal
font.capitalization: Font.AllUppercase
opacity: 0.2
color: "#FFFFFF"
}
}
/*Left Side Icons*/
Image {
id:forthLeftIndicator
width: 72
height: 62
anchors{
left: parent.left
leftMargin: 175
bottom: thirdLeftIndicator.top
bottomMargin: 25
}
source: "qrc:/assets/Parking lights.svg"
}
Image {
id:thirdLeftIndicator
width: 52
height: 70.2
anchors{
left: parent.left
leftMargin: 145
bottom: secondLeftIndicator.top
bottomMargin: 25
}
source: "qrc:/assets/Lights.svg"
}
Image {
id:secondLeftIndicator
width: 51
height: 51
anchors{
left: parent.left
leftMargin: 125
bottom: firstLeftIndicator.top
bottomMargin: 30
}
source: "qrc:/assets/Low beam headlights.svg"
}
Image {
id:firstLeftIndicator
width: 51
height: 51
anchors{
left: parent.left
leftMargin: 100
verticalCenter: speedLabel.verticalCenter
}
source: "qrc:/assets/Rare fog lights.svg"
}
/*Right Side Icons*/
Image {
id:forthRightIndicator
width: 56.83
height: 36.17
anchors{
right: parent.right
rightMargin: 195
bottom: thirdRightIndicator.top
bottomMargin: 50
}
opacity: 0.4
source: "qrc:/assets/FourthRightIcon.svg"
}
Image {
id:thirdRightIndicator
width: 56.83
height: 36.17
anchors{
right: parent.right
rightMargin: 155
bottom: secondRightIndicator.top
bottomMargin: 50
}
opacity: 0.4
source: "qrc:/assets/thirdRightIcon.svg"
}
Image {
id:secondRightIndicator
width: 56.83
height: 36.17
anchors{
right: parent.right
rightMargin: 125
bottom: firstRightIndicator.top
bottomMargin: 50
}
opacity: 0.4
source: "qrc:/assets/SecondRightIcon.svg"
}
Image {
id:firstRightIndicator
width: 36
height: 45
anchors{
right: parent.right
rightMargin: 100
verticalCenter: speedLabel.verticalCenter
}
source: "qrc:/assets/FirstRightIcon.svg"
}
// Progress Bar
RadialBar {
id:radialBar
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: parent.width / 6
}
width: 338
height: 338
penStyle: Qt.RoundCap
dialType: RadialBar.NoDial
progressColor: "#01E4E0"
backgroundColor: "transparent"
dialWidth: 17
startAngle: 270
spanAngle: 3.6 * value
minValue: 0
maxValue: 100
value: 97
textFont {
family: "inter"
italic: false
bold: Font.Medium
pixelSize: 60
}
showText: false
suffixText: ""
textColor: "#FFFFFF"
ColumnLayout{
anchors.centerIn: parent
Label{
text: radialBar.value + "%"
font.pixelSize: 65
font.family: "Inter"
font.bold: Font.Normal
color: "#FFFFFF"
Layout.alignment: Qt.AlignHCenter
}
Label{
text: "Battery charge"
font.pixelSize: 28
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
Layout.alignment: Qt.AlignHCenter
}
}
}
ColumnLayout{
spacing: 40
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: parent.width / 6
}
RowLayout{
spacing: 30
Image {
width: 90
height: 50
source: "qrc:/assets/Group 28.svg"
}
ColumnLayout{
Label{
text: "188 KM"
font.pixelSize: 30
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
Label{
text: "Distance"
font.pixelSize: 20
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
}
}
RowLayout{
spacing: 30
Image {
width: 72
height: 78
source: "qrc:/assets/fuel.svg"
}
ColumnLayout{
Label{
text: "34 mpg"
font.pixelSize: 30
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
Label{
text: "Avg. Fuel Usage"
font.pixelSize: 20
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
}
}
RowLayout{
spacing: 30
Image {
width: 78.72
height: 78.68
source: "qrc:/assets/speedometer.svg"
}
ColumnLayout{
Label{
text: "78 mph"
font.pixelSize: 30
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
Label{
text: "Avg. Speed"
font.pixelSize: 20
font.family: "Inter"
font.bold: Font.Normal
opacity: 0.8
color: "#FFFFFF"
}
}
}
}
}
}