fix: use Loader for animation to reduce cpu usage
This commit is contained in:
parent
5ab1088f7c
commit
7c856be981
|
@ -9,33 +9,26 @@ Item {
|
||||||
visible: walletModel.collectibles.rowCount() === 0
|
visible: walletModel.collectibles.rowCount() === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
SVGImage {
|
Loader {
|
||||||
id: loadingImg
|
id: loadingImg
|
||||||
visible: false
|
active: false
|
||||||
|
sourceComponent: loadingImageComponent
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Style.currentPadding
|
anchors.topMargin: Style.currentPadding
|
||||||
anchors.verticalCenter: txtPassword.verticalCenter
|
anchors.verticalCenter: txtPassword.verticalCenter
|
||||||
// TODO replace by a real loading image
|
}
|
||||||
source: "../../img/settings.svg"
|
|
||||||
width: 30
|
Component {
|
||||||
height: 30
|
id: loadingImageComponent
|
||||||
fillMode: Image.Stretch
|
LoadingImage {}
|
||||||
RotationAnimator {
|
|
||||||
target: loadingImg;
|
|
||||||
from: 0;
|
|
||||||
to: 360;
|
|
||||||
duration: 1200
|
|
||||||
running: true
|
|
||||||
loops: Animation.Infinite
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: walletModel
|
target: walletModel
|
||||||
onLoadingCollectibles: {
|
onLoadingCollectibles: {
|
||||||
loadingImg.visible = isLoading
|
loadingImg.active = isLoading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.13
|
||||||
|
import "."
|
||||||
|
|
||||||
|
SVGImage {
|
||||||
|
id: loadingImg
|
||||||
|
// TODO replace by a real loading image
|
||||||
|
source: "../app/img/settings.svg"
|
||||||
|
width: 30
|
||||||
|
height: 30
|
||||||
|
fillMode: Image.Stretch
|
||||||
|
RotationAnimator {
|
||||||
|
target: loadingImg;
|
||||||
|
from: 0;
|
||||||
|
to: 360;
|
||||||
|
duration: 1200
|
||||||
|
running: true
|
||||||
|
loops: Animation.Infinite
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue