Make links in messages clickable

This commit is contained in:
miruka 2019-04-17 10:54:55 -04:00
parent a7bf1fca44
commit aa105e0c2c
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,23 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
HLabel {
id: "label"
textFormat: Text.RichText
MouseArea {
id: "mouseArea"
anchors.fill: parent
hoverEnabled: true
onPositionChanged: function (event) {
cursorShape = label.linkAt(event.x, event.y) ?
Qt.PointingHandCursor : Qt.ArrowCursor
}
onClicked: function(event) {
var link = label.linkAt(event.x, event.y)
if (link) { Qt.openUrlExternally(link) }
}
}
}

View File

@ -30,7 +30,7 @@ Row {
topPadding: verticalPadding topPadding: verticalPadding
} }
Base.HLabel { Base.RichLabel {
id: contentLabel id: contentLabel
//text: (isOwn ? "" : content + "  ") + //text: (isOwn ? "" : content + "  ") +
//"<font size=" + smallSize + "px color=gray>" + //"<font size=" + smallSize + "px color=gray>" +