From 6c92f4cad191e504dacefbf1552c5467a4dc0071 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 6 Dec 2019 07:07:40 -0400 Subject: [PATCH] Hide tooltips when window not hovered anymore --- src/qml/Base/HToolTip.qml | 6 +++++- src/qml/Window.qml | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qml/Base/HToolTip.qml b/src/qml/Base/HToolTip.qml index ee370075..7507a4f5 100644 --- a/src/qml/Base/HToolTip.qml +++ b/src/qml/Base/HToolTip.qml @@ -11,6 +11,10 @@ ToolTip { property alias label: label property alias backgroundColor: background.color + readonly property bool hideNow: visible && ! window.hovered + + onHideNowChanged: if (hideNow) toolTip.hide() + background: Rectangle { id: background @@ -46,7 +50,7 @@ ToolTip { } TapHandler { - onTapped: { toolTip.hide() } + onTapped: toolTip.hide() } HoverHandler { diff --git a/src/qml/Window.qml b/src/qml/Window.qml index f7e972e9..2a44b791 100644 --- a/src/qml/Window.qml +++ b/src/qml/Window.qml @@ -13,6 +13,8 @@ ApplicationWindow { color: "transparent" + readonly property alias hovered: windowHover.hovered + readonly property bool hidden: Qt.application.state == Qt.ApplicationSuspended || Qt.application.state == Qt.ApplicationHidden || @@ -36,8 +38,11 @@ ApplicationWindow { readonly property alias py: py + Python { id: py } + HoverHandler { id: windowHover } + HLoader { anchors.fill: parent source: py.ready ? "" : "LoadingScreen.qml"