moment/src/qml/Base/HRichLabel.qml

32 lines
849 B
QML
Raw Normal View History

2019-04-18 00:54:55 +10:00
import QtQuick 2.7
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) }
}
onPressAndHold: mouse.accepted = false
onDoubleClicked: mouse.accepted = false
onPressed: mouse.accepted = false
onReleased: mouse.accepted = false
onWheel: mouse.accepted = false
2019-04-18 00:54:55 +10:00
}
}