Fix URLs on QT 6 map.

This commit is contained in:
srcejon 2024-02-28 12:34:03 +00:00
parent 3522feb355
commit 0d333a910e
2 changed files with 11 additions and 8 deletions

View File

@ -307,14 +307,12 @@ Item {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
//propagateComposedEvents: true // so links in Text work
onClicked: {
if (mouse.button === Qt.LeftButton) {
selected = !selected
if (selected) {
mapModel.moveToFront(mapModelFiltered.mapRowToSource(index))
}
//mouse.accepted = false // propagate to text
} else if (mouse.button === Qt.RightButton) {
menuItems.clear()
menus.clear()

View File

@ -316,12 +316,6 @@ Item {
height: text.height + 5
radius: 5
visible: mapTextVisible
Text {
id: text
anchors.centerIn: parent
text: mapText
textFormat: TextEdit.RichText
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
@ -417,6 +411,17 @@ Item {
object.menu.removeItem(object)
}
}
}
}
// Have Text after MouseArea, so links can be clicked
Text {
id: text
anchors.centerIn: parent
text: mapText
textFormat: TextEdit.RichText
onLinkActivated: {
console.log("Link", link);
mapModel.link(link);
}
}
}