fix: use Loader for animation to reduce cpu usage

This commit is contained in:
Richard Ramos 2020-07-30 16:46:25 -04:00
parent 5ab1088f7c
commit 7c856be981
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
2 changed files with 28 additions and 16 deletions

View File

@ -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
} }
} }

View File

@ -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
}
}