summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/location/places_map/doc/src/places_map.qdoc8
-rw-r--r--examples/location/places_map/places_map.qml23
2 files changed, 12 insertions, 19 deletions
diff --git a/examples/location/places_map/doc/src/places_map.qdoc b/examples/location/places_map/doc/src/places_map.qdoc
index 7c6f3c1c..c8d5b715 100644
--- a/examples/location/places_map/doc/src/places_map.qdoc
+++ b/examples/location/places_map/doc/src/places_map.qdoc
@@ -35,8 +35,8 @@
\image places_map.png
The example displays a map of the current location or, if no position is
- available, it uses Brisbane/Australia. Subsequently a search for places
- matching the term "pizza" is performed and each result shown on the map.
+ available, it uses Oslo/Norway. Subsequently a search for places
+ matching the term "food" is performed and each result shown on the map.
\include examples-run.qdocinc
@@ -75,9 +75,9 @@
\snippet places_map/places_map.qml Places MapItemView
Finally, a \c PositionSource is used to reset the map to the curent
- location and find "pizza" places in the new area. The position information
+ location and find "food" places in the new area. The position information
is updated every 2 minutes and if the new position is more than 500 meters
- away from the last pizza search area the place search is retriggered.
+ away from the last food search area the place search is retriggered.
\snippet places_map/places_map.qml Current Location
*/
diff --git a/examples/location/places_map/places_map.qml b/examples/location/places_map/places_map.qml
index 66fcab18..61e845f3 100644
--- a/examples/location/places_map/places_map.qml
+++ b/examples/location/places_map/places_map.qml
@@ -71,34 +71,27 @@ Rectangle {
//! [Current Location]
PositionSource {
id: positionSource
- property variant lastSearchPosition: locationOslo
+ property variant lastSearchPosition: QtPositioning.coordinate(59.93, 10.76) //Initialized/Fallback to Oslo
active: true
updateInterval: 120000 // 2 mins
onPositionChanged: {
- var currentPosition = positionSource.position.coordinate
- map.center = currentPosition
- var distance = currentPosition.distanceTo(lastSearchPosition)
+ var distance = lastSearchPosition.distanceTo(position.coordinate)
if (distance > 500) {
- // 500m from last performed pizza search
- lastSearchPosition = currentPosition
- searchModel.searchArea = QtPositioning.circle(currentPosition)
- searchModel.update()
+ // 500m from last performed food search
+ lastSearchPosition = positionSource.position.coordinate
}
}
}
//! [Current Location]
//! [PlaceSearchModel]
- property variant locationOslo: QtPositioning.coordinate( 59.93, 10.76)
-
PlaceSearchModel {
id: searchModel
plugin: myPlugin
- searchTerm: "Pizza"
- searchArea: QtPositioning.circle(locationOslo, 500000 /* 5 km radius */)
-
+ searchTerm: "food"
+ searchArea: QtPositioning.circle(positionSource.lastSearchPosition, 1000 /* 1 km radius */)
Component.onCompleted: update()
}
//! [PlaceSearchModel]
@@ -108,8 +101,8 @@ Rectangle {
id: map
anchors.fill: parent
plugin: myPlugin;
- center: locationOslo
- zoomLevel: 5
+ center: positionSource.lastSearchPosition
+ zoomLevel: 13
MapItemView {
model: searchModel