/usr/share/qt5/doc/qtlocation/qtlocation-places-map-example.html is in qtlocation5-doc-html 5.2.1-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- places-map.qdoc -->
<title>Places Map (QML) | QtLocation 5.2</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.2</li>
<li><a href="qtlocation-index.html">Qt Location</a></li>
<li>Places Map (QML)</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<h1 class="title">Places Map (QML)</h1>
<span class="subtitle"></span>
<!-- $$$places_map-description -->
<div class="descr"> <a name="details"></a>
<p>The Places Map example demonstrates how to search for and display a list of places on a map using a <a href="qml-qtlocation-mapitemview.html">MapItemView</a><p class="centerAlign"><img src="images/places-map.jpg" alt="" /></p><p>To write a QML application that will show places on a map, we start by making the following import declarations.</p>
<pre class="qml">import QtQuick 2.0
import QtPositioning 5.2
import QtLocation 5.0</pre>
<p>Instantiate a <a href="qml-qtlocation-plugin.html">Plugin</a> instance. The <a href="qml-qtlocation-plugin.html">Plugin</a> is effectively the backend from where places are sourced from. Because the <tt>nokia</tt> plugin has been specified, some mandatory parameters need to be filled in, see the <a href="location-plugin-nokia.html#mandatory-parameters">Nokia Plugin</a> documentation for details:</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-plugin.html">Plugin</a></span> {
<span class="name">id</span>: <span class="name">myPlugin</span>
<span class="name">name</span>: <span class="string">"nokia"</span>
<span class="comment">//specify plugin parameters if necessary</span>
<span class="comment">//PluginParameter {...}</span>
<span class="comment">//PluginParameter {...}</span>
<span class="comment">//...</span>
}</pre>
<p>Next we instantiate a <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a> which we can use to specify search parameters and perform a places search operation. For illustrative purposes, <a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> is invoked once construction of the model is complete. Typically <a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> would be invoked in response to a user action such as a button click.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a></span> {
<span class="name">id</span>: <span class="name">searchModel</span>
<span class="name">plugin</span>: <span class="name">myPlugin</span>
<span class="name">searchTerm</span>: <span class="string">"Pizza"</span>
<span class="comment">//Brisbane</span>
<span class="name">searchArea</span>: <span class="name">QtPositioning</span>.<span class="name">circle</span>(<span class="name">QtPositioning</span>.<span class="name">coordinate</span>(-<span class="number">27.46778</span>, <span class="number">153.02778</span>))
<span class="name">Component</span>.onCompleted: <span class="name">update</span>()
}</pre>
<p>The map is displayed by using the <a href="qml-qtlocation-map.html">Map</a> type and inside we declare the <a href="qml-qtlocation-mapitemview.html">MapItemView</a> and supply the search model and a delegate. An inline delegate has been used and we have assumed that every search result is of <a href="qml-qtlocation-placesearchmodel.html#search-result-types">type</a> <tt>PlaceSerachesult</tt>. Consequently it is assumed that we always have access to the <i>place</i> <a href="qml-qtlocation-placesearchmodel.html#placesearchmodel-roles">role</a>, other search result types may not have a <i>place</i> <a href="qml-qtlocation-placesearchmodel.html#placesearchmodel-roles">role</a>.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-map.html">Map</a></span> {
<span class="name">id</span>: <span class="name">map</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">plugin</span>: <span class="name">myPlugin</span>;
<span class="type">center</span> {
<span class="name">latitude</span>: -<span class="number">27.47</span>
<span class="name">longitude</span>: <span class="number">153.025</span>
}
<span class="name">zoomLevel</span>: <span class="number">13</span>
<span class="type"><a href="qml-qtlocation-mapitemview.html">MapItemView</a></span> {
<span class="name">model</span>: <span class="name">searchModel</span>
<span class="name">delegate</span>: <span class="name">MapQuickItem</span> {
<span class="name">coordinate</span>: <span class="name">place</span>.<span class="name">location</span>.<span class="name">coordinate</span>
<span class="name">anchorPoint</span>.x: <span class="name">image</span>.<span class="name">width</span> <span class="operator">*</span> <span class="number">0.5</span>
<span class="name">anchorPoint</span>.y: <span class="name">image</span>.<span class="name">height</span>
<span class="name">sourceItem</span>: <span class="name">Image</span> {
<span class="name">id</span>: <span class="name">image</span>
<span class="name">source</span>: <span class="string">"marker.png"</span>
}
}
}
}</pre>
<p>Files:</p>
<ul>
<li><a href="qtlocation-places-map-places-map-qml.html">places_map/places_map.qml</a></li>
<li><a href="qtlocation-places-map-main-cpp.html">places_map/main.cpp</a></li>
<li><a href="qtlocation-places-map-places-map-pro.html">places_map/places_map.pro</a></li>
</ul>
</div>
<!-- @@@places_map -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|