From adaf4a9ee2fa81034fce3f9c127b488c15185285 Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Thu, 6 Oct 2022 19:06:50 +0400 Subject: [PATCH] Fix(Communities): Change cursor shape on hovering ColorPicker Close #7778 --- .../StatusQ/Components/StatusColorSpace.qml | 25 +++++++++++-------- .../Controls/StatusColorRadioButton.qml | 8 ++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Components/StatusColorSpace.qml b/ui/StatusQ/src/StatusQ/Components/StatusColorSpace.qml index fc2df5253e..0eb9388ac5 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusColorSpace.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusColorSpace.qml @@ -92,23 +92,26 @@ Item { MouseArea { id: hueArea - property bool pressedOnGauge: false + property bool hoverOnGauge: false anchors.fill: parent + hoverEnabled: true preventStealing: true - onPressed: { - // Check we clicked on gauge + cursorShape: hoverOnGauge ? Qt.PointingHandCursor : Qt.ArrowCursor + onPositionChanged: { + // Check we hovering gauge let dist = Math.sqrt(Math.pow(width / 2 - mouseX, 2) + Math.pow(height / 2 - mouseY, 2)); let radius = Math.min(width, height) / 2; - if (dist < radius - thickness || dist > radius) - return; + hoverOnGauge = !(dist < radius - thickness || dist > radius); - pressedOnGauge = true; - pickRootColor(); + if (hoverOnGauge && pressed) + pickRootColor(); + } + onPressed: { + if (hoverOnGauge) + pickRootColor(); } - onReleased: pressedOnGauge = false - onPositionChanged: if (pressedOnGauge) pickRootColor() function pickRootColor() { // Update both colors @@ -151,13 +154,15 @@ Item { MouseArea { id: satValArea anchors.fill: parent + hoverEnabled: true preventStealing: true + cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor onPressed: { d.pickingSatVal = true; pickColor(); } onReleased: d.pickingSatVal = false - onPositionChanged: pickColor() + onPositionChanged: if (pressed) pickColor() function pickColor() { root.color = pickColorFromSatValRect(mouseX, mouseY); diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml b/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml index 38692af7c8..6f0d385592 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml @@ -32,5 +32,13 @@ RadioButton { border.color: StatusColors.colors['grey3'] } } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onPressed: mouse.accepted = false + } }