2019-07-21 21:14:16 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
2019-07-24 16:14:34 +10:00
|
|
|
BusyIndicator {
|
|
|
|
id: indicator
|
|
|
|
implicitWidth: Math.min(192, Math.max(64, parent.width / 5))
|
|
|
|
implicitHeight: 10
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
Rectangle {
|
2019-07-25 06:21:34 +10:00
|
|
|
id: circle
|
|
|
|
width: height
|
2019-07-24 16:14:34 +10:00
|
|
|
height: indicator.height
|
|
|
|
radius: height / 2
|
|
|
|
|
2019-07-25 05:33:36 +10:00
|
|
|
ColorAnimation on color {
|
|
|
|
// Can't swap direct colors values
|
|
|
|
property string c1: "white"
|
|
|
|
property string c2: theme ? theme.colors.accentText : "cyan"
|
|
|
|
|
|
|
|
id: colorAnimation
|
|
|
|
from: c1
|
|
|
|
to: c2
|
|
|
|
duration: 1000
|
|
|
|
onStopped: {[c1, c2] = [c2, c1]; start()}
|
|
|
|
}
|
|
|
|
|
2019-07-24 16:14:34 +10:00
|
|
|
XAnimator on x {
|
|
|
|
from: 0
|
2019-07-25 06:21:34 +10:00
|
|
|
to: indicator.width - circle.width
|
2019-07-25 05:33:36 +10:00
|
|
|
duration: colorAnimation.duration / 2
|
2019-07-24 16:14:34 +10:00
|
|
|
onStopped: {[from, to] = [to, from]; start()}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|