diff --git a/src/declarativeimports/plasmacomponents3/ProgressBar.qml b/src/declarativeimports/plasmacomponents3/ProgressBar.qml index 5c796293e..0bef7b9cf 100644 --- a/src/declarativeimports/plasmacomponents3/ProgressBar.qml +++ b/src/declarativeimports/plasmacomponents3/ProgressBar.qml @@ -35,8 +35,12 @@ T.ProgressBar { alwaysRunToEnd: true running: control.indeterminate && control.visible - onStarted: indicator.width = units.gridUnit * 2 - onStopped: indicator.width = parent.width * control.position + onStarted: indicator.width = Qt.binding(function() { + return units.gridUnit * 2; + }); + onStopped: indicator.width = Qt.binding(function() { + return indicator.parent.width * control.position; + }); PropertyAnimation { target: indicator diff --git a/tests/components/progressbar3.qml b/tests/components/progressbar3.qml index 796c082ae..1bb47c788 100644 --- a/tests/components/progressbar3.qml +++ b/tests/components/progressbar3.qml @@ -160,5 +160,40 @@ ComponentBase { } } + ColumnLayout { + PlasmaComponents.Label { + text: "This should do one 'indefinite' animation cycle and then continuously animate to 100% in chunks of 10%." + wrapMode: Text.WordWrap + Layout.preferredWidth: progressBarWidth + } + PlasmaComponents.ProgressBar { + id: animatingProgressBar + from: 0 + to: 100 + // Bug 430544: A ProgressBar that was indeterminate once will + // not update its bar size according to its value anymore + // Set to false again in the Timer below + indeterminate: true + + Timer { + interval: 500 + triggeredOnStart: true + running: true + repeat: true + onTriggered: { + animatingProgressBar.indeterminate = false; + + // ProgressBar clamps "value" by "to" (100), so we can't + // just blindly increase and then check >= 100 + if (animatingProgressBar.value === 100) { + animatingProgressBar.value = 0; + } else { + animatingProgressBar.value += 10; + } + } + } + } + } + } }