moment/src/qml/Base/HProgressBar.qml

45 lines
1.2 KiB
QML
Raw Normal View History

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