[PC3 ProgressBar] Set binding for width
Otherwise the progress bar will never update its size when it was indeterminate at one point.. BUG: 430544
This commit is contained in:
parent
4d2d834583
commit
85f136ff41
@ -35,8 +35,12 @@ T.ProgressBar {
|
|||||||
alwaysRunToEnd: true
|
alwaysRunToEnd: true
|
||||||
running: control.indeterminate && control.visible
|
running: control.indeterminate && control.visible
|
||||||
|
|
||||||
onStarted: indicator.width = units.gridUnit * 2
|
onStarted: indicator.width = Qt.binding(function() {
|
||||||
onStopped: indicator.width = parent.width * control.position
|
return units.gridUnit * 2;
|
||||||
|
});
|
||||||
|
onStopped: indicator.width = Qt.binding(function() {
|
||||||
|
return indicator.parent.width * control.position;
|
||||||
|
});
|
||||||
|
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: indicator
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user