blob: 7b238b4fd49d676b6538882ceeed2b6cc84ea0af (
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
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls
import QtQuick.Templates as T
import QtQuick.NativeStyle as NativeStyle
T.ProgressBar {
id: root
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
readonly property bool __notCustomizable: true
background: Item {
implicitWidth: 100
implicitHeight: NativeStyle.StyleConstants.runningWithLiquidGlass ? 8 : 12
readonly property bool __ignoreNotCustomizable: true
Loader {
active: NativeStyle.StyleConstants.runningWithLiquidGlass
width: parent.width
height: root.background.implicitHeight
sourceComponent: Rectangle {
y: (parent.height - height) / 2
radius: height / 2
color: NativeStyle.StyleConstants.tertiarySystemFillColor
border.color: NativeStyle.StyleConstants.secondarySystemFillColor
border.width: 1
}
}
Loader {
active: !NativeStyle.StyleConstants.runningWithLiquidGlass
width: parent.width
height: root.background.implicitHeight
sourceComponent: NativeStyle.ProgressBar {
control: root
useNinePatchImage: false
}
}
}
contentItem: Loader {
active: NativeStyle.StyleConstants.runningWithLiquidGlass
readonly property bool __ignoreNotCustomizable: true
property real animPos: 0
sourceComponent: Item {
// The outer item is resized by the control.
// The inner rectangle is resized according to the progress.
Rectangle {
property real minBlockSize: 10
property real maxBlockSize: parent.width * 0.5;
property real margin: (maxBlockSize - minBlockSize) / (2 * parent.width);
property real pos: -margin + (animPos * (1 + (margin * 2)));
property real pixelPos: pos * parent.width
property real trackLeft: pixelPos > (maxBlockSize / 2) ? pixelPos - (maxBlockSize / 2) : 0;
property real trackRight: pixelPos > parent.width - (maxBlockSize / 2)
? parent.width : pixelPos + (maxBlockSize / 2);
x: root.indeterminate ? trackLeft : 0
y: (parent.height - height) / 2
width: root.indeterminate ? trackRight - trackLeft : parent.width * root.position
height: 8
radius: height / 2
color: Application.state === Qt.ApplicationActive ? palette.accent : "lightgray"
SequentialAnimation {
running: root.indeterminate
loops: Animation.Infinite
NumberAnimation {
target: root.contentItem
property: "animPos"
to: 1
duration: 800
easing.type: Easing.OutCubic
}
PauseAnimation { duration: 100 }
NumberAnimation {
target: root.contentItem
property: "animPos"
to: 0
duration: 800
easing.type: Easing.OutCubic
}
PauseAnimation { duration: 100 }
}
}
}
}
}
|