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 <mitch.curtis@qt.io>
(cherry picked from commit 3211100411)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8f2aa4de88)
This commit is contained in:
Tim Angus 2023-09-26 17:22:38 +00:00 committed by Qt Cherry-pick Bot
parent 000e0ec516
commit 147ecd467d
2 changed files with 31 additions and 3 deletions

View File

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

View File

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