fix: using loaders for status button animations
This commit is contained in:
parent
1481f2648f
commit
17f1f72113
|
@ -22,6 +22,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
/* Commented due to high cpu usage */
|
||||
/*
|
||||
RowLayout {
|
||||
StatusButton {
|
||||
text: "Primary Large Button"
|
||||
|
@ -182,6 +184,7 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,21 @@ Button {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.fill: parent
|
||||
color: !enabled ? Style.current.buttonDisabledForegroundColor : Style.current.buttonForegroundColor
|
||||
visible: !loadingIndicator.visible
|
||||
visible: !loadingIndicator.active
|
||||
}
|
||||
|
||||
LoadingImage {
|
||||
|
||||
Component {
|
||||
id: loadingComponent
|
||||
LoadingImage {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loadingIndicator
|
||||
visible: control.state === "pending"
|
||||
active: control.state === "pending"
|
||||
sourceComponent: loadingComponent
|
||||
height: loadingIndicator.visible ?
|
||||
control.size === "large" ?
|
||||
23 : 17
|
||||
|
|
|
@ -95,15 +95,24 @@ RoundButton {
|
|||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
LoadingImage {
|
||||
Component {
|
||||
id: loadingComponent
|
||||
LoadingImage {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loadingIndicator
|
||||
visible: false
|
||||
active: control.state === "pending"
|
||||
sourceComponent: loadingComponent
|
||||
height: size === "small" ? 14 : 18
|
||||
width: loadingIndicator.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
||||
ColorOverlay {
|
||||
anchors.fill: iconImg
|
||||
visible: control.state === "default"
|
||||
|
@ -124,14 +133,7 @@ RoundButton {
|
|||
Style.current.roundedButtonDisabledForegroundColor
|
||||
antialiasing: true
|
||||
|
||||
RotationAnimator {
|
||||
target: loadingOverlay
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1200
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue