This file is indexed.

/usr/share/qt5/doc/qtlocation/qtlocation-places-map-example.html is in qtlocation5-doc-html 5.5.1-3ubuntu1.

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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- places-map.qdoc -->
  <title>Places Map (QML) | Qt Location 5.5</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.5</li>
<li><a href="qtlocation-index.html">Qt Location</a></li>
<li>Places Map (QML)</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#running-the-example">Running the Example</a></li>
<li class="level1"><a href="#local-search">Local Search</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Places Map (QML)</h1>
<span class="subtitle"></span>
<!-- $$$places_map-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/places-map.png" alt="" /></p><p>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 &quot;pizza&quot; is performed and each result shown on the map.</p>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p>
<a name="local-search"></a>
<h2 id="local-search">Local Search</h2>
<p>To write the 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.5
import QtLocation 5.5</pre>
<p>Instantiate a <a href="location-places-qml.html#plugin">Plugin</a> instance. The <a href="location-places-qml.html#plugin">Plugin</a> is effectively the backend from where places are sourced from. Depending on the chosen plugin some manadatory parameters may be needed. In this case the <a href="location-plugin-osm.html">OSM plugin</a> is selected which does not have any mandatory parameters.</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">&quot;osm&quot;</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">property <span class="type">variant</span> <span class="name">locationOslo</span>: <span class="name">QtPositioning</span>.<span class="name">coordinate</span>( <span class="number">59.93</span>, <span class="number">10.76</span>)

<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">&quot;Pizza&quot;</span>
    <span class="name">searchArea</span>: <span class="name">QtPositioning</span>.<span class="name">circle</span>(<span class="name">locationOslo</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> <code>PlaceSerachesult</code>. 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="name">center</span>: <span class="name">locationOslo</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">Column</span> {
                <span class="type">Image</span> { <span class="name">id</span>: <span class="name">image</span>; <span class="name">source</span>: <span class="string">&quot;marker.png&quot;</span> }
                <span class="type">Text</span> { <span class="name">text</span>: <span class="name">title</span>; <span class="name">font</span>.bold: <span class="number">true</span> }
            }
        }
    }
}</pre>
<p>Finally, a <code>PositionSource</code> is used to reset the map to the curent location and find &quot;pizza&quot; 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.</p>
<pre class="qml"><span class="type">PositionSource</span> {
    <span class="name">id</span>: <span class="name">positionSource</span>
    property <span class="type">variant</span> <span class="name">lastSearchPosition</span>: <span class="name">locationOslo</span>
    <span class="name">active</span>: <span class="number">true</span>
    <span class="name">updateInterval</span>: <span class="number">120000</span> <span class="comment">// 2 mins</span>
    <span class="name">onPositionChanged</span>:  {
        var <span class="name">currentPosition</span> = <span class="name">positionSource</span>.<span class="name">position</span>.<span class="name">coordinate</span>
        <span class="name">map</span>.<span class="name">center</span> <span class="operator">=</span> <span class="name">currentPosition</span>
        var <span class="name">distance</span> = <span class="name">currentPosition</span>.<span class="name">distanceTo</span>(<span class="name">lastSearchPosition</span>)
        <span class="keyword">if</span> (<span class="name">distance</span> <span class="operator">&gt;</span> <span class="number">500</span>) {
            <span class="comment">// 500m from last performed pizza search</span>
            <span class="name">lastSearchPosition</span> <span class="operator">=</span> <span class="name">currentPosition</span>
            <span class="name">searchModel</span>.<span class="name">searchArea</span> <span class="operator">=</span> <span class="name">QtPositioning</span>.<span class="name">circle</span>(<span class="name">currentPosition</span>)
            <span class="name">searchModel</span>.<span class="name">update</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>
<li><a href="qtlocation-places-map-places-map-qrc.html">places_map/places_map.qrc</a></li>
</ul>
</div>
<!-- @@@places_map -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
   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>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>