summaryrefslogtreecommitdiff
path: root/examples
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
parentfc0d214c412462cfd463edfe606574daac7a804b (diff)
downloadqtlocation-037e0e93cf35282224dfd6ce899c7c8325f193fb.tar.gz
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')
-rw-r--r--examples/location/mapviewer/ReverseGeocode.qml4
-rw-r--r--examples/location/mapviewer/content/map/MapComponent.qml1
-rw-r--r--examples/location/mapviewer/forms/ReverseGeocodeForm.ui.qml1
-rw-r--r--examples/location/mapviewer/mapviewer.qml58
4 files changed, 21 insertions, 43 deletions
diff --git a/examples/location/mapviewer/ReverseGeocode.qml b/examples/location/mapviewer/ReverseGeocode.qml
index 14ac5b0c..51269d12 100644
--- a/examples/location/mapviewer/ReverseGeocode.qml
+++ b/examples/location/mapviewer/ReverseGeocode.qml
@@ -45,6 +45,7 @@ import "forms"
//Reverse Geocode Dialog
ReverseGeocodeForm {
+ property string title;
property variant coordinate
signal showPlace(variant coordinate)
signal closeForm()
@@ -69,5 +70,8 @@ ReverseGeocodeForm {
Component.onCompleted: {
latitude.text = "" + coordinate.latitude
longitude.text = "" + coordinate.longitude
+ if (title.length != 0) {
+ tabTitle.text = title;
+ }
}
}
diff --git a/examples/location/mapviewer/content/map/MapComponent.qml b/examples/location/mapviewer/content/map/MapComponent.qml
index ae59ffd0..8d159085 100644
--- a/examples/location/mapviewer/content/map/MapComponent.qml
+++ b/examples/location/mapviewer/content/map/MapComponent.qml
@@ -270,7 +270,6 @@ Map {
//! [geocodemodel1]
signal showGeocodeInfo()
- signal moveMarker()
signal geocodeFinished()
signal routeError()
diff --git a/examples/location/mapviewer/forms/ReverseGeocodeForm.ui.qml b/examples/location/mapviewer/forms/ReverseGeocodeForm.ui.qml
index 4f5c0382..c0696a0b 100644
--- a/examples/location/mapviewer/forms/ReverseGeocodeForm.ui.qml
+++ b/examples/location/mapviewer/forms/ReverseGeocodeForm.ui.qml
@@ -48,6 +48,7 @@ Item {
property alias longitude: longitude
property alias latitude: latitude
property alias cancelButton: cancelButton
+ property alias tabTitle: tabTitle
Rectangle {
id: tabRectangle
y: 20
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 }
}