summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-02-24 17:31:03 +0100
committerMichal Klocek <michal.klocek@theqtcompany.com>2015-04-14 08:35:54 +0000
commit8ccac8432b9575e2dbf49e9e887c2581bcee308f (patch)
tree976d2e36c8f30c6b064ace1f4aeefd355aa66919
parent1901c8bc9e1d2a931d541f77b08654b4017f5b5c (diff)
downloadqtlocation-8ccac8432b9575e2dbf49e9e887c2581bcee308f.tar.gz
Refactor code and fix documentation for mapviewer example.
Refactor code so the MapComponent holds the most of revelant code for documenting. Rewrite mapviewer example documentation so it fits the current code snippets. Change-Id: Idf468d2025303a42cea6ca8d24ed541c509911c0 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--examples/location/mapviewer/forms/Geocode.qml8
-rw-r--r--examples/location/mapviewer/forms/RouteCoordinate.qml5
-rw-r--r--examples/location/mapviewer/forms/RouteList.qml25
-rw-r--r--examples/location/mapviewer/map/MapComponent.qml173
-rw-r--r--examples/location/mapviewer/mapviewer.qml50
-rw-r--r--src/location/doc/images/example-mapviewer.pngbin246403 -> 359712 bytes
-rw-r--r--src/location/doc/src/examples/declarative-mapviewer.qdoc91
-rw-r--r--src/location/doc/src/qml-maps.qdoc76
8 files changed, 205 insertions, 223 deletions
diff --git a/examples/location/mapviewer/forms/Geocode.qml b/examples/location/mapviewer/forms/Geocode.qml
index c1d70a45..4484b301 100644
--- a/examples/location/mapviewer/forms/Geocode.qml
+++ b/examples/location/mapviewer/forms/Geocode.qml
@@ -41,15 +41,12 @@
import QtQuick 2.4
import QtPositioning 5.2
-//Geocode Dialog
-//! [geocode0]
GeocodeForm {
- //! [geocode0]
+
property variant address
signal showPlace(variant address)
signal closeForm()
- //! [geocode1]
goButton.onClicked: {
// fill out the Address element
address.street = street.text
@@ -59,7 +56,6 @@ GeocodeForm {
address.postalCode = postalCode.text
showPlace(address)
}
- //! [geocode1]
clearButton.onClicked: {
street.text = ""
@@ -68,7 +64,6 @@ GeocodeForm {
country.text = ""
postalCode.text = ""
}
- //! [geocode2]
cancelButton.onClicked: {
closeForm()
@@ -82,6 +77,5 @@ GeocodeForm {
postalCode.text = address.postalCode
}
}
-//! [geocode2]
diff --git a/examples/location/mapviewer/forms/RouteCoordinate.qml b/examples/location/mapviewer/forms/RouteCoordinate.qml
index 9c593e0a..5a42310b 100644
--- a/examples/location/mapviewer/forms/RouteCoordinate.qml
+++ b/examples/location/mapviewer/forms/RouteCoordinate.qml
@@ -41,15 +41,12 @@
import QtQuick 2.4
import QtPositioning 5.2
-//Route Dialog
-//! [routedialog0]
RouteCoordinateForm {
property variant toCoordinate
property variant fromCoordinate
signal showRoute(variant startCoordinate,variant endCoordinate)
signal closeForm()
- //! [routedialog0]
goButton.onClicked: {
var startCoordinate = QtPositioning.coordinate(parseFloat(fromLatitude.text),
parseFloat(fromLongitude.text));
@@ -78,7 +75,5 @@ RouteCoordinateForm {
toLatitude.text = "" + toCoordinate.latitude
toLongitude.text = "" + toCoordinate.longitude
}
- //! [routedialog1]
}
-//! [routedialog1]
diff --git a/examples/location/mapviewer/forms/RouteList.qml b/examples/location/mapviewer/forms/RouteList.qml
index 200d10dd..a2d7e9df 100644
--- a/examples/location/mapviewer/forms/RouteList.qml
+++ b/examples/location/mapviewer/forms/RouteList.qml
@@ -42,24 +42,23 @@ import QtQuick 2.4
import QtQuick.Controls 1.3
import "../helper.js" as Helper
+//! [routeinfomodel0]
ListView {
+//! [routeinfomodel0]
property variant routeModel
property string totalTravelTime
property string totalDistance
signal closeForm()
-
+//! [routeinfomodel1]
interactive: true
-
- model: ListModel { id: routeList }
-
+ model: ListModel { id: routeInfoModel }
header: RouteListHeader {}
-
delegate: RouteListDelegate{
routeIndex.text: index + 1
routeInstruction.text: instruction
routeDistance.text: distance
}
-
+//! [routeinfomodel1]
footer: Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Close")
@@ -69,16 +68,20 @@ ListView {
}
Component.onCompleted: {
- routeList.clear()
+ //! [routeinfomodel2]
+ routeInfoModel.clear()
if (routeModel.count > 0) {
for (var i = 0; i < routeModel.get(0).segments.length; i++) {
- routeList.append({
- "instruction": routeModel.get(0).segments[i].maneuver.instructionText,
- "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction)
- });
+ routeInfoModel.append({
+ "instruction": routeModel.get(0).segments[i].maneuver.instructionText,
+ "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction)
+ });
}
}
+ //! [routeinfomodel2]
totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
}
+//! [routeinfomodel3]
}
+//! [routeinfomodel3]
diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml
index e3a0f323..6250f6c7 100644
--- a/examples/location/mapviewer/map/MapComponent.qml
+++ b/examples/location/mapviewer/map/MapComponent.qml
@@ -46,7 +46,7 @@ import "../helper.js" as Helper
//! [top]
Map {
id: map
- //! [top]
+//! [top]
property variant markers
property variant mapItems
property int markerCounter: 0 // counter for total amount of markers. Resets to 0 when number of markers = 0
@@ -58,59 +58,9 @@ Map {
property int jitterThreshold : 30
property bool followme: false
property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000]
- //! [routemodel0]
- property RouteQuery routeQuery: RouteQuery {}
-
- property RouteModel routeModel: RouteModel {
- plugin : map.plugin
- query: routeQuery
- //! [routemodel0]
-
- //! [routemodel1]
- onStatusChanged: {
- if (status == RouteModel.Ready) {
- switch (count) {
- case 0:
- // technically not an error
- map.routeError()
- break
- case 1:
- showRouteList()
- break
- }
- } else if (status == RouteModel.Error) {
- map.routeError()
- }
- }
- //! [routemodel1]
-
- //! [routemodel2]
-
- //! [routemodel2]
- //! [routemodel3]
- }
- //! [routemodel3]
-
- //! [geocodemodel0]
- property GeocodeModel geocodeModel: GeocodeModel {
- //! [geocodemodel0]
- //! [geocodemodel0 body]
- plugin: map.plugin
- onStatusChanged: {
- if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error))
- map.geocodeFinished()
- }
- onLocationsChanged:
- {
- if (count == 1) {
- map.center.latitude = get(0).coordinate.latitude
- map.center.longitude = get(0).coordinate.longitude
- }
- }
- //! [geocodemodel0 body]
- //! [geocodemodel1]
- }
- //! [geocodemodel1]
+ property alias routeQuery: routeQuery
+ property alias routeModel: routeModel
+ property alias geocodeModel: geocodeModel
signal showGeocodeInfo()
signal geocodeFinished()
@@ -253,7 +203,8 @@ Map {
if (markers.length == 0) markerCounter = 0
}
- function calculateRoute(){
+ function calculateMarkerRoute()
+ {
routeQuery.clearWaypoints();
for (var i = currentMarker; i< map.markers.length; i++){
routeQuery.addWaypoint(markers[i].coordinate)
@@ -264,16 +215,64 @@ Map {
routeModel.update();
}
- //! [coord]
+ function calculateCoordinateRoute(startCoordinate, endCoordinate)
+ {
+ //! [routerequest0]
+ // clear away any old data in the query
+ routeQuery.clearWaypoints();
+
+ // add the start and end coords as waypoints on the route
+ routeQuery.addWaypoint(startCoordinate)
+ routeQuery.addWaypoint(endCoordinate)
+ routeQuery.travelModes = RouteQuery.CarTravel
+ routeQuery.routeOptimizations = RouteQuery.FastestRoute
+
+ //! [routerequest0]
+
+ //! [routerequest0 feature weight]
+ for (var i=0; i<9; i++) {
+ routeQuery.setFeatureWeight(i, 0)
+ }
+ //for (var i=0; i<routeDialog.features.length; i++) {
+ // map.routeQuery.setFeatureWeight(routeDialog.features[i], RouteQuery.AvoidFeatureWeight)
+ //}
+ //! [routerequest0 feature weight]
+
+ //! [routerequest1]
+ routeModel.update();
+
+ //! [routerequest1]
+ //! [routerequest2]
+ // center the map on the start coord
+ map.center = startCoordinate;
+ //! [routerequest2]
+ }
+
+ function geocode(fromAddress)
+ {
+ //! [geocode1]
+ // send the geocode request
+ geocodeModel.query = fromAddress
+ geocodeModel.update()
+ //! [geocode1]
+ }
+
+
+//! [coord]
+ zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2
center {
+ // The Qt Company in Oslo
latitude: 59.9485
longitude: 10.7686
}
- //! [coord]
+//! [coord]
- // Enable pinch gestures to zoom in and out
+//! [mapnavigation]
+ // Enable pan, flick, and pinch gestures to zoom in and out
+ gesture.activeGestures: MapGestureArea.PanGesture | MapGestureArea.FlickGesture | MapGestureArea.ZoomGesture
gesture.flickDeceleration: 3000
gesture.enabled: true
+//! [mapnavigation]
onCopyrightLinkActivated: Qt.openUrlExternally(link)
onCenterChanged:{
@@ -407,6 +406,32 @@ Map {
}
}
+ //! [routemodel0]
+ RouteModel {
+ id: routeModel
+ plugin : map.plugin
+ query: RouteQuery {
+ id: routeQuery
+ }
+ onStatusChanged: {
+ if (status == RouteModel.Ready) {
+ switch (count) {
+ case 0:
+ // technically not an error
+ map.routeError()
+ break
+ case 1:
+ map.showRouteList()
+ break
+ }
+ } else if (status == RouteModel.Error) {
+ map.routeError()
+ }
+ }
+ }
+ //! [routemodel0]
+
+ //! [routedelegate0]
Component {
id: routeDelegate
@@ -417,7 +442,7 @@ Map {
line.width: 5
smooth: true
opacity: 0.8
- //! [routedelegate0]
+ //! [routedelegate0]
MouseArea {
id: routeMouseArea
anchors.fill: parent
@@ -450,11 +475,29 @@ Map {
}
}
}
+ //! [routedelegate1]
}
- //! [routedelegate1]
}
//! [routedelegate1]
+ //! [geocodemodel0]
+ GeocodeModel {
+ id: geocodeModel
+ plugin: map.plugin
+ onStatusChanged: {
+ if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error))
+ map.geocodeFinished()
+ }
+ onLocationsChanged:
+ {
+ if (count == 1) {
+ map.center.latitude = get(0).coordinate.latitude
+ map.center.longitude = get(0).coordinate.longitude
+ }
+ }
+ }
+ //! [geocodemodel0]
+
//! [pointdel0]
Component {
id: pointDelegate
@@ -500,18 +543,20 @@ Map {
}
}
}
- //! [pointdel1]
+ //! [pointdel1]
}
}
//! [pointdel1]
- //! [routeview]
+ //! [routeview0]
MapItemView {
model: routeModel
delegate: routeDelegate
+ //! [routeview0]
autoFitViewport: true
+ //! [routeview1]
}
- //! [routeview]
+ //! [routeview1]
//! [geocodeview]
MapItemView {
@@ -578,6 +623,6 @@ Map {
}
}
}
- //! [end]
+//! [end]
}
//! [end]
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml
index d15058ba..491bc47f 100644
--- a/examples/location/mapviewer/mapviewer.qml
+++ b/examples/location/mapviewer/mapviewer.qml
@@ -53,8 +53,10 @@ ApplicationWindow {
property variant parameters
//defaults
+ //! [routecoordinate]
property variant fromCoordinate: QtPositioning.coordinate(59.9483, 10.7695)
property variant toCoordinate: QtPositioning.coordinate(59.9645, 10.671)
+ //! [routecoordinate]
function createMap(provider)
{
@@ -168,6 +170,7 @@ ApplicationWindow {
visible: true
menuBar: mainMenu
+ //! [geocode0]
Address {
id :fromAddress
street: "Sandakerveien 116"
@@ -176,6 +179,7 @@ ApplicationWindow {
state : ""
postalCode: "0484"
}
+ //! [geocode0]
Address {
id: toAddress
@@ -198,42 +202,6 @@ ApplicationWindow {
}
}
- //! [routerequest0]
- function showRoute(startCoordinate, endCoordinate)
- {
- // clear away any old data in the query
- map.routeQuery.clearWaypoints();
-
- // add the start and end coords as waypoints on the route
- map.routeQuery.addWaypoint(startCoordinate)
- map.routeQuery.addWaypoint(endCoordinate)
- map.routeQuery.travelModes = RouteQuery.CarTravel
- map.routeQuery.routeOptimizations = RouteQuery.FastestRoute
- //! [routerequest0]
-
- //! [routerequest0 feature weight]
- for (var i=0; i<9; i++) {
- map.routeQuery.setFeatureWeight(i, 0)
- }
- //for (var i=0; i<routeDialog.features.length; i++) {
- // map.routeQuery.setFeatureWeight(routeDialog.features[i], RouteQuery.AvoidFeatureWeight)
- //}
- //! [routerequest0 feature weight]
-
- //! [routerequest1]
- map.routeModel.update();
- // center the map on the start coord
- map.center = startCoordinate;
- //! [routerequest1]
- }
-
- function showPlace(geocode)
- {
- // send the geocode request
- map.geocodeModel.query = geocode
- map.geocodeModel.update()
- }
-
function setLanguage(lang)
{
map.plugin.locales = lang;
@@ -277,7 +245,7 @@ ApplicationWindow {
properties: { "plugin": map.plugin,
"toAddress": toAddress,
"fromAddress": fromAddress}})
- stackView.currentItem.showRoute.connect(showRoute)
+ stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
stackView.currentItem.showMessage.connect(stackView.showMessage)
stackView.currentItem.closeForm.connect(stackView.closeForm)
break
@@ -285,19 +253,19 @@ ApplicationWindow {
stackView.push({ item: Qt.resolvedUrl("forms/RouteCoordinate.qml") ,
properties: { "toCoordinate": toCoordinate,
"fromCoordinate": fromCoordinate}})
- stackView.currentItem.showRoute.connect(showRoute)
+ stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
stackView.currentItem.closeForm.connect(stackView.closeForm)
break
case "Geocode":
stackView.push({ item: Qt.resolvedUrl("forms/Geocode.qml") ,
properties: { "address": fromAddress}})
- stackView.currentItem.showPlace.connect(showPlace)
+ stackView.currentItem.showPlace.connect(map.geocode)
stackView.currentItem.closeForm.connect(stackView.closeForm)
break
case "RevGeocode":
stackView.push({ item: Qt.resolvedUrl("forms/ReverseGeocode.qml") ,
properties: { "coordinate": fromCoordinate}})
- stackView.currentItem.showPlace.connect(showPlace)
+ stackView.currentItem.showPlace.connect(map.geocode)
stackView.currentItem.closeForm.connect(stackView.closeForm)
break
case "Language":
@@ -405,7 +373,7 @@ ApplicationWindow {
break;
case "routeToNextPoint":
case "routeToNextPoints":
- map.calculateRoute()
+ map.calculateMarkerRoute()
break
case "distanceToNextPoint":
var coordinate1 = map.markers[currentMarker].coordinate;
diff --git a/src/location/doc/images/example-mapviewer.png b/src/location/doc/images/example-mapviewer.png
index 4dcac4fa..4dc13f72 100644
--- a/src/location/doc/images/example-mapviewer.png
+++ b/src/location/doc/images/example-mapviewer.png
Binary files differ
diff --git a/src/location/doc/src/examples/declarative-mapviewer.qdoc b/src/location/doc/src/examples/declarative-mapviewer.qdoc
index 7bf95f54..f62f535d 100644
--- a/src/location/doc/src/examples/declarative-mapviewer.qdoc
+++ b/src/location/doc/src/examples/declarative-mapviewer.qdoc
@@ -47,8 +47,8 @@
\endcode
Refer to the documentation for each of the geo services plugins for details on what plugin
- parameters they support. The HERE services plugin supplied with Qt requires an \e app_id and
- \e token pair. See "\l {Qt Location HERE Plugin}" for details.
+ parameters they support. The default plugin used by this example is
+ \l {Qt Location Open Street Map Plugin}, which does not require any parameters.
QML types shown in this example:
@@ -57,7 +57,7 @@
\list
\li \l{QtLocation::Map}{Map}
\li \l{QtLocation::MapGestureArea}{MapGestureArea}
- \li \l{coordinate}
+ \li \l[QML]{Coordinate}
\endlist
\li Finding an address
\list
@@ -79,63 +79,48 @@
Drawing a map on-screen is accomplished using the Map type, as shown
below.
- \snippet mapviewer/content/map/MapComponent.qml top
- \snippet mapviewer/content/map/MapComponent.qml coord
- \snippet mapviewer/content/map/MapComponent.qml end
+ \snippet mapviewer/map/MapComponent.qml top
+ \snippet mapviewer/map/MapComponent.qml coord
+ \snippet mapviewer/map/MapComponent.qml end
- In this example, we give the map an initial center \l {coordinate}
+ In this example, we give the map an initial center \l [QML]{Coordinate}{coordinate}
with a set latitude and longitude. We also set the initial zoom level to 50% (halfway between
the maximum and minimum).
- The calls to "pinch" and "flick" are used to enable gestures on the map.
- The flick gesture is also sometimes known as "kinetic panning", and provides
- a more intuitive feel for panning the map both on touch screens and with
- a mouse.
-
- As we do not specify a plugin for supplying map data, the platform default
- will be used. This is typically the "osm" plugin, which provides data from
- OpenStreetMap services. Additional licensing conditions do apply to the use of this data,
- please see the documentation for further details.
-
\section2 Finding an Address (Geocoding)
To locate a certain address or place on the map uses a process called
geocoding. In order to perform a geocode operation, we first need to adjust
our Map object to be able to receive the result.
- Receiving results of geocoding is done through a GeocodeModel, which is
- typically instantiated as a property of the Map component:
+ Receiving results of geocoding is done through a GeocodeModel:
- \snippet mapviewer/content/map/MapComponent.qml geocodemodel0
- \snippet mapviewer/content/map/MapComponent.qml geocodemodel1
+ \snippet mapviewer/map/MapComponent.qml geocodemodel0
- Then, to display the contents of the GeocodeModel we use a MapItemView:
+ To display the contents of the GeocodeModel we use a MapItemView:
- \snippet mapviewer/content/map/MapComponent.qml geocodeview
+ \snippet mapviewer/map/MapComponent.qml geocodeview
MapItemView uses an object called a "delegate" to act as a template for the
items it creates. This can contain any map object desired, but in this case
we show a MapCircle:
- \snippet mapviewer/content/map/MapComponent.qml pointdel0
- \snippet mapviewer/content/map/MapComponent.qml pointdel1
+ \snippet mapviewer/map/MapComponent.qml pointdel0
+ \snippet mapviewer/map/MapComponent.qml pointdel1
With these three objects, we have enough to receive Geocode responses and
display them on our Map. The final piece is to send the actual Geocode
request.
- In this example, we have a utility component called Dialog which we use
- to display the user interface requesting geocoding parameters. You can
- create a similar component yourself using Dialog.qml in this example
- as a reference, or drive the process using any other UI you wish.
-
- To send a geocode request, first we create an Address object, and fill it
- in with the desired parameters. Then we set "map.geocodeModel.query" to
- the filled in Address, and call update() on the GeocodeModel.
+ To send a geocode request, first we create an \l [QML]{Address} object, and fill it
+ in with the desired parameters.
\snippet mapviewer/mapviewer.qml geocode0
- \snippet mapviewer/mapviewer.qml geocode1
- \snippet mapviewer/mapviewer.qml geocode2
+
+ Then we set "geocodeModel.query" to the filled in \l [QML]{Address},
+ and call update() on the GeocodeModel.
+
+ \snippet mapviewer/map/MapComponent.qml geocode1
\section2 Directions and Travel Routes
@@ -145,49 +130,49 @@
Here again, we instantiate the RouteModel as a property of our Map:
- \snippet mapviewer/content/map/MapComponent.qml routemodel0
- \snippet mapviewer/content/map/MapComponent.qml routemodel3
+ \snippet mapviewer/map/MapComponent.qml routemodel0
To display the contents of a model to the user, we need a view. Once again
we will use a MapItemView, to display the Routes as objects on the Map:
- \snippet mapviewer/content/map/MapComponent.qml routeview
+ \snippet mapviewer/map/MapComponent.qml routeview0
+ \snippet mapviewer/map/MapComponent.qml routeview1
To act as a template for the objects we wish the view to create, we create
a delegate component:
- \snippet mapviewer/content/map/MapComponent.qml routedelegate0
- \snippet mapviewer/content/map/MapComponent.qml routedelegate1
+ \snippet mapviewer/map/MapComponent.qml routedelegate0
+ \snippet mapviewer/map/MapComponent.qml routedelegate1
With the model, view and delegate now complete, the only missing component
is some kind of control over the model to begin the Route request process.
In the simplest case, we can fill out a Route request using two already
- available \l {coordinate}{coordinates}, which we store inside the RouteDialog
- component:
+ available \l [QML]{Coordinate}{coordinates}:
- \snippet mapviewer/mapviewer.qml routedialog0
- \snippet mapviewer/mapviewer.qml routedialog1
+ \snippet mapviewer/mapviewer.qml routecoordinate
In the next snippet, we show how to set up the request object and instruct
the model to update. We also instruct the map to center on the start
coordinate for our routing request.
- \snippet mapviewer/mapviewer.qml routerequest0
- \snippet mapviewer/mapviewer.qml routerequest1
+ \snippet mapviewer/map/MapComponent.qml routerequest0
+ \snippet mapviewer/map/MapComponent.qml routerequest1
+ \snippet mapviewer/map/MapComponent.qml routerequest2
This is all that is required to display a Route on the Map. However, it is
also useful to be able to retrieve the written directions and explanation
- of the travel route. In the example, these are displayed in the pull-out
- on the left-hand side of the map. To create this pull-out's contents, we
- use a standard \l {Models and Views in Qt Quick#ListModel}{ListModel} and
+ of the travel route. In the example, these are displayed in a \l {ListView} element.
+ To create this content, we use a standard \l {Models and Views in Qt Quick#ListModel}{ListModel} and
\l {ListView} pair. The data in the \l {Models and Views in Qt Quick#ListModel}{ListModel} is
built from the routeModel's output:
- \snippet mapviewer/content/map/MapComponent.qml routeinfomodel
+ \snippet mapviewer/forms/RouteList.qml routeinfomodel0
+ \snippet mapviewer/forms/RouteList.qml routeinfomodel1
+ \snippet mapviewer/forms/RouteList.qml routeinfomodel3
- Inside the RouteModel, we add an
+ Inside the RouteModel, as you can see above, we add an
\l{QtLocation::RouteModel::status}{onStatusChanged} handler, which
- calls the \c{update()} function we defined on the model:
+ calls the \c{showRouteList()} which updates the \c{routeInfoModel}:
- \snippet mapviewer/content/map/MapComponent.qml routemodel1
+ \snippet mapviewer/forms/RouteList.qml routeinfomodel2
*/
diff --git a/src/location/doc/src/qml-maps.qdoc b/src/location/doc/src/qml-maps.qdoc
index 9b7bd03f..ebae9582 100644
--- a/src/location/doc/src/qml-maps.qdoc
+++ b/src/location/doc/src/qml-maps.qdoc
@@ -99,22 +99,23 @@ The following code examples are a small part of the \c map component in the
\l {Map Viewer (QML)}{Map Viewer (QML)} example. The snippets
demonstrate the declaration of the \l GeocodeModel component.
-In the snippet we see that the \c geocodeModel property contains the plugin
-and two signal handlers. One for changes in status (\c onStatusChanged ) and
-the other to update the centering of the Map object (\c onLocationsChanged ).
+In the snippet we see that the [QML]{GeocodeModel} contains the plugin
+and two signal handlers. One for changes in status \l [QML]{GeocodeModel::status}{\c onStatusChanged} and
+the other to update the centering of the Map object \l [QML]{GeocodeModel::locationsChanged}{\c onLocationsChanged}.
-\snippet mapviewer/content/map/MapComponent.qml geocodemodel0
-\snippet mapviewer/content/map/MapComponent.qml geocodemodel0 body
-\snippet mapviewer/content/map/MapComponent.qml geocodemodel1
+\snippet mapviewer/map/MapComponent.qml geocodemodel0
\codeline
-\snippet mapviewer/content/map/MapComponent.qml geocodeview
+\snippet mapviewer/map/MapComponent.qml geocodeview
-These geocoding features are called from a higher level piece of code. In this
-snippet we see an \c onGoButtonClicked signal handler that extracts the address
-from the user interface and then creates a query for the \l GeocodeModel to
-process and determine the geographical coordinates.
+The geocoding features are called from a higher level piece of code. In this
+snippet we see an \l [QML]{Address} object filled with the desired parameters.
-\snippet mapviewer/mapviewer.qml geocode1
+\snippet mapviewer/mapviewer.qml geocode0
+
+The \l [QML]{Address} is later used in a query for the \l GeocodeModel to
+process and determine the geographical \l [QML]{Coordinate}{coordinates}.
+
+\snippet mapviewer/map/MapComponent.qml geocode1
\section2 Navigation
@@ -164,40 +165,31 @@ The \l RouteQuery properties can include
\endtable
-In the following example a default RouteQuery is declared, later to be defined
-by some user input, and used in \c routeModel as the query. The \c routeInfoModel
-is a \l {Models and Views in Qt Quick#ListModel}{ListModel} that can be updated using an
-\c update() function that we will look at later.
+In the following example a default \l [QML]{RouteQuery} is declared within \l [QML]{RouteModel}.
-\snippet mapviewer/content/map/MapComponent.qml routemodel0
-\codeline
-\snippet mapviewer/content/map/MapComponent.qml routemodel1
-\codeline
-\snippet mapviewer/content/map/MapComponent.qml routemodel2
-\snippet mapviewer/content/map/MapComponent.qml routemodel3
+\snippet mapviewer/map/MapComponent.qml routemodel0
-The user enters, via a dialog, some information such as the starting point
+The user enters some information such as the starting point
of the route, some waypoints and the destination. All of these locations are
waypoints so the locations from start to finish will be entered as a sequence
of waypoints. Then other query properties can be set that may be specific to
this trip.
-\snippet mapviewer/mapviewer.qml routerequest0
-\codeline
-\snippet mapviewer/mapviewer.qml routerequest0 feature weight
-\codeline
-\snippet mapviewer/mapviewer.qml routerequest1
-\snippet mapviewer/mapviewer.qml routedialog1
+\snippet mapviewer/map/MapComponent.qml routerequest0
+\snippet mapviewer/map/MapComponent.qml routerequest1
The \c routeInfoModel \l {Models and Views in Qt Quick#ListModel}{ListModel} is used to grab the
-results of the query and construct a suitable list for display. The
-\l {Models and Views in Qt Quick#ListModel}{ListModel} \c routeInfoModel contains an \c update()
-function that loops through the segments extracting the segment length, instruction text and
-distance to the next instruction. The extracted data is formatted for display as it is retrieved.
+results of the query and construct a suitable list for display.
+\snippet mapviewer/forms/RouteList.qml routeinfomodel0
+\snippet mapviewer/forms/RouteList.qml routeinfomodel1
+\snippet mapviewer/forms/RouteList.qml routeinfomodel3
-\snippet mapviewer/content/map/MapComponent.qml routeinfomodel
-\codeline
-\snippet mapviewer/content/map/MapComponent.qml routeview
+The \l {Models and Views in Qt Quick#ListModel}{ListModel} \c routeInfoModel can be filled
+with values using a code, that loops through the segments extracting the segment length,
+instruction text and distance to the next instruction. The extracted data is formatted
+for display as it is retrieved.
+
+\snippet mapviewer/forms/RouteList.qml routeinfomodel2
For more information on the example see the \l {Map Viewer (QML)}{Map Viewer (QML)} example.
@@ -210,14 +202,14 @@ pinching to zoom.
Enabling and configuring pinch and flickable is easy within the \l Map type.
-\snippet mapviewer/content/map/MapComponent.qml top
-\snippet mapviewer/content/map/MapComponent.qml end
+\snippet mapviewer/map/MapComponent.qml top
+\snippet mapviewer/map/MapComponent.qml mapnavigation
+\snippet mapviewer/map/MapComponent.qml end
-Zoom can also be controlled by other objects like sliders, as shown in the
-example, by implementing the \c onValueChanged handler to update the Map
-\l {QtLocation::Map::}{zoomLevel}.
+Zoom can also be controlled by other objects like sliders, with binding
+to the Map \l {QtLocation::Map::}{zoomLevel}.
-\section1 Types
+\section1 QML Types
\section3 Maps
\annotatedlist qml-QtLocation5-maps