Make links in messages clickable
This commit is contained in:
parent
a7bf1fca44
commit
aa105e0c2c
23
harmonyqml/components/base/RichLabel.qml
Normal file
23
harmonyqml/components/base/RichLabel.qml
Normal 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) }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ Row {
|
|||
topPadding: verticalPadding
|
||||
}
|
||||
|
||||
Base.HLabel {
|
||||
Base.RichLabel {
|
||||
id: contentLabel
|
||||
//text: (isOwn ? "" : content + " ") +
|
||||
//"<font size=" + smallSize + "px color=gray>" +
|
||||
|
|
Loading…
Reference in New Issue
Block a user