diff options
author | Jean Gressmann <jean.gressmann@nokia.com> | 2012-03-07 16:38:10 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-14 23:47:19 +0100 |
commit | b36948312d237924f268f5c1308abea3911e0d92 (patch) | |
tree | b07f4fac7950d60d19a9d0d7c085a2cc25466326 | |
parent | e1beef48f4fa0217be1a61ddde695780542df981 (diff) | |
download | qtlocation-b36948312d237924f268f5c1308abea3911e0d92.tar.gz |
mapviewer: marker lose it's coordinate when panning
Fix for QTBUG-23329
Made sure the map center property and the marker coordinate objects
don't refer to the same object.
This really goes to show how much making QDeclarativeCoordinate a value
type in QML would help.
Change-Id: I59b4f5e16724b79436be7a6230ce473b979ae1a8
Reviewed-by: Natalia Shubina <natalia.shubina@nokia.com>
-rw-r--r-- | examples/declarative/mapviewer/mapviewer.qml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/examples/declarative/mapviewer/mapviewer.qml b/examples/declarative/mapviewer/mapviewer.qml index 706331da..4b8e467b 100644 --- a/examples/declarative/mapviewer/mapviewer.qml +++ b/examples/declarative/mapviewer/mapviewer.qml @@ -460,9 +460,22 @@ Item { onGoButtonClicked: { page.state = "" messageDialog.state = "" - map.markers[map.currentMarker].coordinate.latitude = dialogModel.get(0).inputText - map.markers[map.currentMarker].coordinate.longitude = dialogModel.get(1).inputText - map.center = map.markers[map.currentMarker].coordinate + var latitude = parseFloat(dialogModel.get(0).inputText) + var longitude = parseFloat(dialogModel.get(1).inputText) + + if (latitude !== "NaN" && longitude !== "NaN") { + + var coordinate = Qt.createQmlObject('import QtLocation 5.0; Coordinate {}', map) + coordinate.latitude = latitude + coordinate.longitude = longitude + + if (coordinate.isValid) { + map.markers[map.currentMarker].coordinate.latitude = latitude + map.markers[map.currentMarker].coordinate.longitude = longitude + map.center.latitude = latitude + map.center.longitude = longitude + } + } } onCancelButtonClicked: { |