From 7474a6fc6683a66257871245fbe064de7ccd1b24 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 28 Feb 2020 16:55:52 +0100 Subject: [PATCH] Don't swallow hover-events over MessageText --- qml/MessageText.qml | 18 ++++++++++++++++-- qml/MessageView.qml | 16 ---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/qml/MessageText.qml b/qml/MessageText.qml index 0647fdb..1ddf459 100644 --- a/qml/MessageText.qml +++ b/qml/MessageText.qml @@ -11,13 +11,27 @@ TextEdit readOnly: true persistentSelection: true selectionColor: Material.accent + textFormat: Text.RichText + + onLinkActivated: function(link) { + if (link.startsWith("telephant://")) { + var us = link.substr(12, link.length).split("/") + if (us[1] == "user") { + uiBridge.loadAccount(us[us.length-1]) + ComponentCreator.createAccountPopup(this).open(); + } + if (us[1] == "tag") { + uiBridge.tag(us[us.length-1]) + } + } else + Qt.openUrlExternally(link) + } MouseArea { anchors.fill: parent // we don't want to eat clicks on the Label acceptedButtons: Qt.RightButton - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor - hoverEnabled: true + cursorShape: label.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor propagateComposedEvents: true onReleased: { diff --git a/qml/MessageView.qml b/qml/MessageView.qml index 5bc73ca..d746e39 100644 --- a/qml/MessageView.qml +++ b/qml/MessageView.qml @@ -236,28 +236,12 @@ ColumnLayout { MessageText { visible: message.body.length > 0 && (!message.sensitive || showSensitiveContent) text: "" + message.body - textFormat: Text.RichText font.pointSize: 11 Layout.fillWidth: true wrapMode: Text.WordWrap opacity: (accountBridge.username == message.author && (message.like || message.forward)) ? 0.4 : 1.0 color: "white" - onLinkActivated: function(link) { - if (link.startsWith("telephant://")) { - var us = link.substr(12, link.length).split("/") - - if (us[1] == "user") { - uiBridge.loadAccount(us[us.length-1]) - ComponentCreator.createAccountPopup(this).open(); - } - if (us[1] == "tag") { - uiBridge.tag(us[us.length-1]) - } - } else - Qt.openUrlExternally(link) - } - onClicked: function() { uiBridge.loadConversation(message.messageid) ComponentCreator.createConversationPopup(this).open();