From 147ecd467d545898e1fe60bca952aa784949cb72 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 26 Sep 2023 17:22:38 +0000 Subject: [PATCH] Fix BusyIndicator invisibility under Fusion style When an initially invisible BusyIndicator is first made visible under the Fusion style, it does not in actuality become visible. This is because the QQuickFusionBusyIndicator::itemChange() function ignores ItemVisibleHasChanged, so the appropriate actions don't take place. The fix is a partial copy and paste of QQuickMaterialBusyIndicator::itemChange's implementation which has identical logic except for calling the appropriate ::itemChange() super function. Task-number: QTBUG-108808 Pick-to: 6.5 Change-Id: Id92c62a1eef4fc278ab91097f04db5b41a5d2c8a Reviewed-by: Mitch Curtis (cherry picked from commit 321110041143065a6939b157a0e85510ec5a0841) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 8f2aa4de88db7a4d5c7c35d30df0688fa1e52594) --- .../fusion/impl/qquickfusionbusyindicator.cpp | 13 ++++++++++-- .../controls/data/tst_busyindicator.qml | 21 ++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/quickcontrols/fusion/impl/qquickfusionbusyindicator.cpp b/src/quickcontrols/fusion/impl/qquickfusionbusyindicator.cpp index cce69b0e4b..8e58b09ed3 100644 --- a/src/quickcontrols/fusion/impl/qquickfusionbusyindicator.cpp +++ b/src/quickcontrols/fusion/impl/qquickfusionbusyindicator.cpp @@ -71,8 +71,17 @@ void QQuickFusionBusyIndicator::itemChange(ItemChange change, const ItemChangeDa { QQuickPaintedItem::itemChange(change, data); - if (change == ItemOpacityHasChanged && qFuzzyIsNull(data.realValue)) - setVisible(false); + switch (change) { + case ItemOpacityHasChanged: + if (qFuzzyIsNull(data.realValue)) + setVisible(false); + break; + case ItemVisibleHasChanged: + update(); + break; + default: + break; + } } QT_END_NAMESPACE diff --git a/tests/auto/quickcontrols/controls/data/tst_busyindicator.qml b/tests/auto/quickcontrols/controls/data/tst_busyindicator.qml index 7385677f93..69b1cc1d11 100644 --- a/tests/auto/quickcontrols/controls/data/tst_busyindicator.qml +++ b/tests/auto/quickcontrols/controls/data/tst_busyindicator.qml @@ -22,7 +22,14 @@ TestCase { id: mouseArea MouseArea { } } - + + Component { + id: busyIndicatorInItem + Item { + BusyIndicator { } + } + } + function init() { failOnWarning(/.?/) } @@ -63,4 +70,16 @@ TestCase { touch.release(0, control).commit() verify(!ma.pressed) } + + // QTBUG-108808 + function test_visibility() { + let control = createTemporaryObject(busyIndicatorInItem, testCase, {visible: false}) + verify(control) + + let invisibleImage = grabImage(control) + control.visible = true + let visibleImage = grabImage(control) + + verify(!invisibleImage.equals(visibleImage)) + } }