summaryrefslogtreecommitdiffstats
path: root/examples/location/mapviewer/mapviewer.qml
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-02-10 18:17:11 +0100
committerMichal Klocek <michal.klocek@theqtcompany.com>2015-04-13 14:54:18 +0000
commit037e0e93cf35282224dfd6ce899c7c8325f193fb (patch)
tree1319e15b77da4ef839aaeb3e876f7437fce0d20a /examples/location/mapviewer/mapviewer.qml
parentfc0d214c412462cfd463edfe606574daac7a804b (diff)
Replace new coordinate dialog in mapviewer example.
Use qtquickcontroles based one. Change-Id: Ib67e12d55bfba53997857210dea26a314ff827fd Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location/mapviewer/mapviewer.qml')
-rw-r--r--examples/location/mapviewer/mapviewer.qml58
1 files changed, 16 insertions, 42 deletions
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml
index 993439c3..74df5a54 100644
--- a/examples/location/mapviewer/mapviewer.qml
+++ b/examples/location/mapviewer/mapviewer.qml
@@ -278,9 +278,6 @@ ApplicationWindow {
showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode")); \
}\
}\
- onMoveMarker: {\
- page.state = "Coordinates";\
- }\
onRouteError: {\
showMessage(qsTr("Route Error"),qsTr("Unable to find a route for the given points"),page);\
}\
@@ -378,7 +375,7 @@ ApplicationWindow {
} else if (item === "getMarkerCoordinate") {
map.coordinatesCaptured(map.markers[map.currentMarker].coordinate.latitude, map.markers[map.currentMarker].coordinate.longitude)
} else if (item === "moveMarkerTo") {
- map.moveMarker()
+ askForCoordinate()
} else if (item === "showDrawMenu") {
map.drawItemPopup()
} else if (item === "routeToNextPoint" || item === "routeToNextPoints") {
@@ -398,6 +395,21 @@ ApplicationWindow {
markerPopupMenu.popup()
}
+ function askForCoordinate() {
+ stackView.push({ item: Qt.resolvedUrl("ReverseGeocode.qml") ,
+ properties: { "title": qsTr("New Coordinate"),
+ "coordinate": map.markers[map.currentMarker].coordinate}})
+ stackView.currentItem.showPlace.connect(moveMarker)
+ stackView.currentItem.closeForm.connect(closeForm)
+ }
+
+ function moveMarker(coordinate)
+ {
+ map.markers[map.currentMarker].coordinate = coordinate;
+ map.center = coordinate;
+ stackView.pop(page)
+ }
+
}
@@ -417,36 +429,6 @@ ApplicationWindow {
//=====================Dialogs=====================
- //Get new coordinates for marker
- OwnControls.InputDialog {
- id: coordinatesDialog
- title: "New coordinates"
- z: backgroundRect.z + 2
-
- Component.onCompleted: {
- var obj = [["Latitude", ""],["Longitude", ""]]
- setModel(obj)
- }
-
- onGoButtonClicked: {
- page.state = ""
- var newLat = parseFloat(dialogModel.get(0).inputText)
- var newLong = parseFloat(dialogModel.get(1).inputText)
-
- if (newLat !== "NaN" && newLong !== "NaN") {
- var c = QtPositioning.coordinate(newLat, newLong);
- if (c.isValid) {
- map.markers[map.currentMarker].coordinate = c;
- map.center = c;
- }
- }
- }
-
- onCancelButtonClicked: {
- page.state = ""
- }
- }
-
//Get new locale
OwnControls.InputDialog {
id: localeDialog
@@ -471,10 +453,6 @@ ApplicationWindow {
//=====================States of page=====================
states: [
State {
- name: "Coordinates"
- PropertyChanges { target: coordinatesDialog; opacity: 1 }
- },
- State {
name : "Locale"
PropertyChanges { target: localeDialog; opacity: 1 }
}
@@ -483,10 +461,6 @@ ApplicationWindow {
//=====================State-transition animations for page=====================
transitions: [
Transition {
- to: "Coordinates"
- NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear }
- },
- Transition {
to: ""
NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear }
}