mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
mapwidget.qml: open current location in Google Maps
openLocationInGoogleMaps() now can be used to open a URL in an external browser, triggered by the context menu. Use the same Google Maps URL formating as in main.qml showMap(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
4d0d0e102b
commit
621dd53a43
1 changed files with 7 additions and 1 deletions
|
@ -138,6 +138,12 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function openLocationInGoogleMaps(latitude, longitude) {
|
||||
var loc = latitude + " " + longitude
|
||||
var url = "https://www.google.com/maps/place/" + loc + "/@" + loc + ",5000m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
|
||||
Qt.openUrlExternally(url)
|
||||
}
|
||||
|
||||
MapWidgetContextMenu {
|
||||
id: contextMenu
|
||||
y: 10; x: map.width - y
|
||||
|
@ -145,7 +151,7 @@ Item {
|
|||
// TODO: perform action actions
|
||||
switch (action) {
|
||||
case contextMenu.actions.OPEN_LOCATION_IN_GOOGLE_MAPS:
|
||||
console.log("OPEN_LOCATION_IN_GOOGLE_MAPS");
|
||||
openLocationInGoogleMaps(map.center.latitude, map.center.longitude)
|
||||
break;
|
||||
case contextMenu.actions.COPY_LOCATION_DECIMAL:
|
||||
console.log("COPY_LOCATION_DECIMAL");
|
||||
|
|
Loading…
Add table
Reference in a new issue