From 71a2951f5bca0bc5bbe979195b8f44f7bfbc7b24 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 23 Aug 2020 15:17:06 -0400 Subject: [PATCH] Move tooltip window hover detector to HToolTip Having a HoverHandler covering the root ApplicationWindow causes problems for some Qt Quick Controls with pen/touch, e.g. it's impossible to focus a TextArea/TextField. The HoverHandler is moved to HToolTip (since it's used for those), targets the ApplicationWindow but is now only enabled while a tooltip is visible. --- src/gui/Base/HToolTip.qml | 10 ++++++---- src/gui/Window.qml | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/Base/HToolTip.qml b/src/gui/Base/HToolTip.qml index 8bbb399b..16660979 100644 --- a/src/gui/Base/HToolTip.qml +++ b/src/gui/Base/HToolTip.qml @@ -12,8 +12,6 @@ ToolTip { property alias label: label property alias backgroundColor: background.color - readonly property bool hideNow: ! window.hovered - function instantShow(timeout=-1) { if (visible) return @@ -58,8 +56,6 @@ ToolTip { HNumberAnimation { property: "opacity"; to: 0.0 } } - onHideNowChanged: if (visible && hideNow) toolTip.hide() - TapHandler { onTapped: toolTip.hide() } @@ -67,4 +63,10 @@ ToolTip { HoverHandler { onHoveredChanged: if (! hovered) toolTip.hide() } + + HoverHandler { + target: mainUI + enabled: toolTip.visible + onHoveredChanged: if (toolTip.visible && ! hovered) toolTip.hide() + } } diff --git a/src/gui/Window.qml b/src/gui/Window.qml index 7ca8ab29..e19e165f 100644 --- a/src/gui/Window.qml +++ b/src/gui/Window.qml @@ -10,7 +10,6 @@ ApplicationWindow { // FIXME: Qt 5.13.1 bug, this randomly stops updating after the cursor // leaves the window until it's clicked again. - readonly property alias hovered: windowHover.hovered readonly property bool hidden: Qt.application.state === Qt.ApplicationSuspended || @@ -85,8 +84,6 @@ ApplicationWindow { Utils { id: utils } - HoverHandler { id: windowHover } - HLoader { anchors.fill: parent source: py.ready ? "" : "LoadingScreen.qml"