Don't swallow hover-events over MessageText

This commit is contained in:
Christian Muehlhaeuser 2020-02-28 16:55:52 +01:00
parent 61f0939f5e
commit 7474a6fc66
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E
2 changed files with 16 additions and 18 deletions

View file

@ -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: {

View file

@ -236,28 +236,12 @@ ColumnLayout {
MessageText {
visible: message.body.length > 0 && (!message.sensitive || showSensitiveContent)
text: "<style>a:link { visibility: hidden; text-decoration: none; color: " + Material.accent + "; }</style>" + 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();