Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/ProgressBar.qml is written in an unsupported language. File is not indexed.
0001 /* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
0002 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003 */
0004
0005 import QtQuick
0006 import QtQuick.Templates as T
0007 import org.kde.kirigami as Kirigami
0008 import org.kde.breeze.impl as Impl
0009
0010 T.ProgressBar {
0011 id: control
0012
0013 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0014 implicitContentWidth + leftPadding + rightPadding)
0015 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0016 implicitContentHeight + topPadding + bottomPadding)
0017
0018 Kirigami.Theme.colorSet: Kirigami.Theme.Button
0019 Kirigami.Theme.inherit: false
0020
0021 contentItem: Item {
0022 implicitWidth: 200
0023 implicitHeight: Impl.Units.grooveHeight
0024 clip: true
0025 Rectangle {
0026 id: progressFill
0027 visible: !control.indeterminate && width > 0
0028 anchors {
0029 left: parent.left
0030 top: parent.top
0031 bottom: parent.bottom
0032 }
0033 width: control.position * parent.width
0034
0035 radius: Impl.Units.grooveHeight/2
0036 color: Kirigami.Theme.alternateBackgroundColor
0037 border {
0038 width: Impl.Units.smallBorder
0039 color: Kirigami.Theme.focusColor
0040 }
0041 }
0042
0043 Item {
0044 id: indeterminateFill
0045
0046 readonly property real __backgroundBorderWidth: control.background?.border?.width ?? 0
0047
0048 anchors {
0049 top: parent.top
0050 bottom: parent.bottom
0051 topMargin: __backgroundBorderWidth
0052 bottomMargin: __backgroundBorderWidth
0053 }
0054 width: parent.width + 2 * __segmentLength
0055 x: - 2 * __segmentLength
0056
0057 clip: true
0058 visible: control.indeterminate && width > 0
0059
0060 readonly property real __segmentLength: 14
0061
0062 Row {
0063 anchors.fill: parent
0064 spacing: indeterminateFill.__segmentLength
0065
0066 Repeater {
0067 model: Math.round(parent.width / (2 * indeterminateFill.__segmentLength))
0068 delegate: Rectangle {
0069 anchors.top: parent.top
0070 anchors.bottom: parent.bottom
0071 implicitWidth: indeterminateFill.__segmentLength
0072 radius: Impl.Units.grooveHeight/2
0073 color: Kirigami.Theme.alternateBackgroundColor
0074 }
0075 }
0076 }
0077
0078 XAnimator on x {
0079 from: - 2 * indeterminateFill.__segmentLength
0080 to: 0
0081 duration: 3 * Kirigami.Units.veryLongDuration
0082 loops: Animation.Infinite
0083 running: true
0084 }
0085 }
0086 }
0087
0088 background: Rectangle {
0089 implicitWidth: 200
0090 implicitHeight: Impl.Units.grooveHeight
0091
0092 radius: Impl.Units.grooveHeight/2
0093 color: Kirigami.Theme.backgroundColor
0094 border {
0095 width: Impl.Units.smallBorder
0096 color: Impl.Theme.separatorColor()
0097 }
0098 }
0099 }