From 504053a6bfd932eb878d9634465d4fb7444e4c33 Mon Sep 17 00:00:00 2001 From: Pascal Precht <445106+PascalPrecht@users.noreply.github.com> Date: Wed, 7 Sep 2022 13:26:16 +0200 Subject: [PATCH] fix(StatusBaseButton): keep `MouseArea` enabled when in `loading` state `StatusBaseButton` comes with a `MouseArea` that is disabled when the button is set to being disabled. Prior to this commit it's *also* disabled when the button is in `loading` state. This makes sense because a button that is in `loading` state shouldn't not emit any click signals or trigger hover indications. There's a scenario though in which we want render a tooltip on top of the button which is in `loading` state. For the tooltip to show, the `MouseArea` of the button needs to be enabled. Hence, this commit adjust `StatusBaseButton`'s behaviour to *not* disable the `MouseArea` when it's `loading`. Mouse events are already prevented via the `loading` flag. So the only thing left to do is to ensure the button doesn't trigger any hover indication when in `loading` state. --- src/StatusQ/Controls/StatusBaseButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StatusQ/Controls/StatusBaseButton.qml b/src/StatusQ/Controls/StatusBaseButton.qml index c5b6bc78..09405cf9 100644 --- a/src/StatusQ/Controls/StatusBaseButton.qml +++ b/src/StatusQ/Controls/StatusBaseButton.qml @@ -89,7 +89,7 @@ Rectangle { color: { if (statusBaseButton.enabled) - return sensor.containsMouse || highlighted ? hoverColor + return !statusButton.loading && (sensor.containsMouse || highlighted) ? hoverColor : normalColor; return disaledColor } @@ -106,7 +106,7 @@ Rectangle { : Qt.PointingHandCursor hoverEnabled: true - enabled: !loading && statusBaseButton.enabled + enabled: statusBaseButton.enabled Loader { anchors.centerIn: parent