diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-02-10 18:17:11 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-04-13 14:54:13 +0000 |
commit | fc0d214c412462cfd463edfe606574daac7a804b (patch) | |
tree | 4b126b2f8c9d82cfb24df09f58d5f2e06320c05c /examples/location/mapviewer/mapviewer.qml | |
parent | d9af6b61ae03a7d8e3bf3295f948bb3f2ce36d9a (diff) |
Replace marker popup menu in mapviewer example.
Use qtquickcontrols based one.
Change-Id: I36cb46aa9de076f0aea3e102802a87369d7195a7
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location/mapviewer/mapviewer.qml')
-rw-r--r-- | examples/location/mapviewer/mapviewer.qml | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml index cc276f1c..993439c3 100644 --- a/examples/location/mapviewer/mapviewer.qml +++ b/examples/location/mapviewer/mapviewer.qml @@ -69,6 +69,7 @@ ApplicationWindow { postalCode: "" } + Address { id: toAddress street: "Heal st" @@ -277,9 +278,6 @@ ApplicationWindow { showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode")); \ }\ }\ - onShowDistance:{\ - showMessage(qsTr("Distance"),"<b>" + qsTr("Distance:") + "</b> " + distance);\ - }\ onMoveMarker: {\ page.state = "Coordinates";\ }\ @@ -308,6 +306,9 @@ ApplicationWindow { onShowMainMenu: {\ mapPopupMenu.show(coordinate);\ }\ + onShowMarkerMenu: {\ + markerPopupMenu.show(coordinate);\ + }\ }',page) map.plugin = plugin; map.zoomLevel = (map.maximumZoomLevel - map.minimumZoomLevel)/2 @@ -368,6 +369,38 @@ ApplicationWindow { } } + MarkerPopupMenu { + id: markerPopupMenu + onItemClicked: { + stackView.pop(page) + if (item === "deleteMarker") { + map.deleteMarker(map.currentMarker) + } else if (item === "getMarkerCoordinate") { + map.coordinatesCaptured(map.markers[map.currentMarker].coordinate.latitude, map.markers[map.currentMarker].coordinate.longitude) + } else if (item === "moveMarkerTo") { + map.moveMarker() + } else if (item === "showDrawMenu") { + map.drawItemPopup() + } else if (item === "routeToNextPoint" || item === "routeToNextPoints") { + map.calculateRoute() + } else if (item === "distanceToNextPoint") { + var coordinate1 = map.markers[currentMarker].coordinate; + var coordinate2 = map.markers[currentMarker+1].coordinate; + var distance = map.formatDistance(coordinate1.distanceTo(coordinate2)); + showMessage(qsTr("Distance"),"<b>" + qsTr("Distance:") + "</b> " + distance) + } + } + + function show(coordinate) { + stackView.pop(page) + markerPopupMenu.markersCount = map.markers.length + markerPopupMenu.update() + markerPopupMenu.popup() + } + + } + + StackView { id: stackView anchors.fill: parent |