2019-08-29 04:28:20 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
|
|
ProgressBar {
|
|
|
|
id: bar
|
|
|
|
|
2019-09-18 06:30:04 +10:00
|
|
|
property color backgroundColor: theme.controls.progressBar.background
|
|
|
|
property color foregroundColor: theme.controls.progressBar.foreground
|
|
|
|
|
2019-08-29 04:28:20 +10:00
|
|
|
background: Rectangle {
|
|
|
|
implicitWidth: 200
|
|
|
|
implicitHeight: theme.controls.progressBar.height
|
2019-09-18 06:30:04 +10:00
|
|
|
color: backgroundColor
|
2019-08-29 04:28:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
implicitWidth: 200
|
|
|
|
implicitHeight: theme.controls.progressBar.height
|
|
|
|
|
|
|
|
Rectangle {
|
2019-11-07 01:08:55 +11:00
|
|
|
id: indicator
|
|
|
|
width: bar.indeterminate ?
|
|
|
|
parent.width / 8 : bar.visualPosition * parent.width
|
2019-08-29 04:28:20 +10:00
|
|
|
height: parent.height
|
2019-09-18 06:30:04 +10:00
|
|
|
color: foregroundColor
|
2019-11-07 01:08:55 +11:00
|
|
|
|
2019-12-06 22:10:22 +11:00
|
|
|
Behavior on color { HColorAnimation {} }
|
|
|
|
|
2019-12-16 19:42:41 +11:00
|
|
|
HNumberAnimation on x {
|
2019-11-13 09:22:57 +11:00
|
|
|
running: bar.indeterminate
|
2019-11-07 01:08:55 +11:00
|
|
|
duration: theme.animationDuration * 8
|
|
|
|
from: 0
|
|
|
|
to: bar.width - indicator.width
|
2019-11-13 09:22:57 +11:00
|
|
|
|
|
|
|
onStopped: if (bar.indeterminate) {
|
|
|
|
[from, to] = [to, from];
|
|
|
|
start()
|
|
|
|
} else {
|
|
|
|
indicator.x = 0
|
|
|
|
}
|
2019-11-07 01:08:55 +11:00
|
|
|
}
|
2019-08-29 04:28:20 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|