From 173d8075ad863c8fe9496d3ce21007177c0cc5ce Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 7 May 2021 04:18:50 +0200 Subject: [PATCH] Show link on hover Fix #279 --- .../NeoChat/Component/Timeline/TextDelegate.qml | 5 +++++ qml/main.qml | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/imports/NeoChat/Component/Timeline/TextDelegate.qml b/imports/NeoChat/Component/Timeline/TextDelegate.qml index 5770ef3d1..5273a4919 100644 --- a/imports/NeoChat/Component/Timeline/TextDelegate.qml +++ b/imports/NeoChat/Component/Timeline/TextDelegate.qml @@ -51,6 +51,11 @@ a{ Layout.fillWidth: true onLinkActivated: RoomManager.openResource(link) + onHoveredLinkChanged: if (hoveredLink.length > 0) { + applicationWindow().hoverLinkIndicator.text = hoveredLink; + } else { + applicationWindow().hoverLinkIndicator.text = ""; + } MouseArea { anchors.fill: parent diff --git a/qml/main.qml b/qml/main.qml index a139007d8..9803dd71c 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -369,4 +369,21 @@ Kirigami.ApplicationWindow { } } } + + property Item hoverLinkIndicator: QQC2.Control { + parent: overlay.parent + property alias text: linkText.text + opacity: text.length > 0 ? 1 : 0 + + z: 20 + x: 0 + y: parent.height - implicitHeight + contentItem: QQC2.Label { + id: linkText + } + Kirigami.Theme.colorSet: Kirigami.Theme.View + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } + } }