Commit 85f136ff authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[PC3 ProgressBar] Set binding for width

Otherwise the progress bar will never update its size when it was indeterminate
at one point..

BUG: 430544
parent 4d2d8345
......@@ -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
......
......@@ -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;
}
}
}
}
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment