Improve the buttons for the location component

Now they are icon-only, the "Open Externally" icon has changed, and a
 fullscreen button has been added.
This commit is contained in:
Joshua Goins
2025-05-20 16:59:00 -04:00
parent 76ce44230d
commit c5eb7578b7

View File

@@ -74,9 +74,40 @@ ColumnLayout {
Component.onCompleted: map.addMapItem(locationMapItem) Component.onCompleted: map.addMapItem(locationMapItem)
TapHandler { Connections {
acceptedButtons: Qt.LeftButton target: mapView.map
onTapped: { function onCopyrightLinkActivated(link: string) {
Qt.openUrlExternally(link);
}
}
RowLayout {
anchors {
top: parent.top
right: parent.right
margins: Kirigami.Units.smallSpacing
}
spacing: Kirigami.Units.mediumSpacing
Button {
text: i18nc("@action:button Open the location in an external program", "Open Externally")
icon.name: "open-link-symbolic"
display: AbstractButton.IconOnly
onClicked: Qt.openUrlExternally("geo:" + root.latitude + "," + root.longitude)
ToolTip.text: text
ToolTip.visible: hovered
ToolTip.delay: Kirigami.Units.toolTipDelay
}
Button {
icon.name: "view-fullscreen"
text: i18nc("@action:button", "Fullscreen")
display: AbstractButton.IconOnly
onClicked: {
let map = fullScreenMap.createObject(parent, { let map = fullScreenMap.createObject(parent, {
latitude: root.latitude, latitude: root.latitude,
longitude: root.longitude, longitude: root.longitude,
@@ -85,32 +116,11 @@ ColumnLayout {
}); });
map.open(); map.open();
} }
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: openMessageContext("")
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: openMessageContext("")
}
Connections {
target: mapView.map
function onCopyrightLinkActivated(link: string) {
Qt.openUrlExternally(link);
}
}
Button { ToolTip.text: text
anchors { ToolTip.visible: hovered
top: parent.top ToolTip.delay: Kirigami.Units.toolTipDelay
right: parent.right
margins: Kirigami.Units.smallSpacing
} }
text: i18nc("@action:button Open the location in an external program", "Open Externally")
icon.name: "compass"
onClicked: Qt.openUrlExternally("geo:" + root.latitude + "," + root.longitude)
} }
} }
Component { Component {