moment/src/qml/Base/HRichLabel.qml

29 lines
714 B
QML
Raw Normal View History

2019-07-08 13:52:41 +10:00
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
2019-04-18 00:54:55 +10:00
HLabel {
id: label
2019-04-18 00:54:55 +10:00
textFormat: Text.RichText
MouseArea {
id: mouseArea
2019-04-18 00:54:55 +10:00
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
2019-04-18 00:54:55 +10:00
onPositionChanged: function (mouse) {
mouse.accepted = false
cursorShape = label.linkAt(mouse.x, mouse.y) ?
2019-04-18 00:54:55 +10:00
Qt.PointingHandCursor : Qt.ArrowCursor
}
onClicked: function(mouse) {
var link = label.linkAt(mouse.x, mouse.y)
mouse.accepted = Boolean(link)
2019-04-18 00:54:55 +10:00
if (link) { Qt.openUrlExternally(link) }
}
}
}