aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <[email protected]>2023-04-28 11:27:07 +0800
committerMitch Curtis <[email protected]>2023-05-01 08:08:52 +0800
commit8efa14829335d91e0d79168bb64b72183a284961 (patch)
treee484c44efd2557dc5256323ba73a125d215d6dff
parente6a363efe86dd6acbceade28d5eddbdca9c7b805 (diff)
BusyIndicator: stop animation when not visible
This prevents unnecessary CPU and GPU usage with the iOS and Fusion styles. It's not currently possible to test this without adding objectNames to each animation, which relies on us remembering to do so. Even then, not all styles use QML animations in their BusyIndicator implementations - some use e.g. QQuickAnimatedNode). Also, there is no QML API to find QObject children of a given type (animations) - I've created QTBUG-113264 to propose such an API. Task-number: QTBUG-50161 Pick-to: 6.5 Change-Id: Ieafb5f2f1a9703d4dc26e4f934dbcc86e2709445 Reviewed-by: Doris Verria <[email protected]>
-rw-r--r--src/quickcontrols/fusion/BusyIndicator.qml2
-rw-r--r--src/quickcontrols/ios/BusyIndicator.qml2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/quickcontrols/fusion/BusyIndicator.qml b/src/quickcontrols/fusion/BusyIndicator.qml
index dcd2f23f49..8de02b6aea 100644
--- a/src/quickcontrols/fusion/BusyIndicator.qml
+++ b/src/quickcontrols/fusion/BusyIndicator.qml
@@ -27,7 +27,7 @@ T.BusyIndicator {
Behavior on opacity { OpacityAnimator { duration: 250 } }
RotationAnimator on rotation {
- running: control.running || control.contentItem.visible
+ running: control.running && control.contentItem.visible
from: 0
to: 360
duration: 1000
diff --git a/src/quickcontrols/ios/BusyIndicator.qml b/src/quickcontrols/ios/BusyIndicator.qml
index 7a2241ca4c..3fb08070df 100644
--- a/src/quickcontrols/ios/BusyIndicator.qml
+++ b/src/quickcontrols/ios/BusyIndicator.qml
@@ -30,7 +30,7 @@ T.BusyIndicator {
(Qt.styleHints.colorScheme === Qt.Light ? "-light.png" : "-dark.png")
fillMode: Image.PreserveAspectFit
NumberAnimation on currentImage {
- running: control.running
+ running: control.visible && control.running
loops: -1
from: 8
to: 1