chore(StatusQ): make StatusLoadingIndicator use Animator

Animator based animations can animate on scene graph's rendering thread
even when the UI thread is blocked.
This commit is contained in:
Patryk Osmaczko 2023-03-24 10:42:22 +01:00
parent 36940cc81e
commit 9b099c13d4
2 changed files with 16 additions and 13 deletions

View File

@ -2,17 +2,16 @@ import QtQuick 2.13
import StatusQ.Core 0.1
StatusIcon {
id: statusIcon
id: root
icon: "loading"
height: 17
width: 17
RotationAnimation {
target: statusIcon;
from: 0;
to: 360;
RotationAnimator {
target: root
from: 0
to: 360
duration: 1200
running: visible
loops: Animation.Infinite
}
}

View File

@ -2,10 +2,11 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
Image {
id: root
property string icon: ""
property color color: "transparent"
id: statusIcon
width: 24
height: 24
// SVGs must have sourceSize, PNGs not; otherwise blurry
@ -24,10 +25,13 @@ Image {
}
}
layer.smooth: true
layer.format: ShaderEffectSource.RGBA
layer.enabled: !Qt.colorEqual(statusIcon.color, "transparent")
layer.effect: ColorOverlay {
color: statusIcon.color
Loader {
anchors.fill: root
active: !Qt.colorEqual(root.color, "transparent")
sourceComponent: ColorOverlay {
source: root
color: root.color
smooth: true
}
}
}