Fix constant CPU usage due to HButtonContent
Unload the animated HBusyIndicator when not needed
This commit is contained in:
parent
919edb52ad
commit
b11bd8331b
1
TODO.md
1
TODO.md
|
@ -1,7 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- mention color in local echo
|
- mention color in local echo
|
||||||
- cpu usage
|
|
||||||
|
|
||||||
## Main goals for next version
|
## Main goals for next version
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ HRowLayout {
|
||||||
visible: button.icon.name || button.loading
|
visible: button.icon.name || button.loading
|
||||||
|
|
||||||
Layout.preferredWidth:
|
Layout.preferredWidth:
|
||||||
button.loading ? busyIndicator.width : icon.width
|
button.loading ? busyIndicatorLoader.width : icon.width
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
@ -45,15 +45,18 @@ HRowLayout {
|
||||||
Behavior on opacity { HNumberAnimation {} }
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
HBusyIndicator {
|
HLoader {
|
||||||
id: busyIndicator
|
id: busyIndicatorLoader
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: height
|
width: height
|
||||||
height: parent.height
|
height: parent.height
|
||||||
opacity: button.loading ? 1 : 0
|
opacity: button.loading ? 1 : 0
|
||||||
visible: opacity > 0
|
active: opacity > 0
|
||||||
|
|
||||||
Behavior on opacity { HNumberAnimation {} }
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
|
|
||||||
|
sourceComponent: HBusyIndicator {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user