/usr/share/qt5/doc/qtlocation/qtlocation-places-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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- declarative-places.qdoc -->
<title>Places (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 (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="#overview">Overview</a></li>
<li class="level1"><a href="#displaying-categories">Displaying Categories</a></li>
<li class="level1"><a href="#presenting-search-suggestions">Presenting Search Suggestions</a></li>
<li class="level1"><a href="#searching-for-places">Searching for Places</a></li>
<li class="level1"><a href="#displaying-place-content">Displaying Place Content</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Places (QML)</h1>
<span class="subtitle"></span>
<!-- $$$places-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/example-places.png" alt="" /></p><p>The Places example demonstrates how to search for Places. In particular it shows how further information such as reviews, images and related content can be retrieved.</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>
<p>The example can work with any of the available geo services plugins. However, some plugins may require additional <a href="qml-qtlocation-pluginparameter.html">plugin parameters</a> in order to function correctly. <a href="qml-qtlocation-pluginparameter.html">Plugin parameters</a> can be passed on the command line using the <code>--plugin</code> argument, which takes the form:</p>
<pre class="cpp">--plugin.<parameter name> <parameter value></pre>
<p>Refer to the documentation for each of the geo services plugins for details on what plugin parameters they support. The default plugin used by this example is <a href="location-plugin-osm.html">Qt Location Open Street Map Plugin</a>, which does not require any parameters.</p>
<a name="overview"></a>
<h2 id="overview">Overview</h2>
<p>The Places example presents an application window displaying a map. At the top of the window is a search box, which is used to enter a place search query. To search for a place enter a search term into the text box and click the magnifying glass icon. To search for a place by category, click the category icon to display the list of available categories and select the desired category. The place search query will be for places that are near the current location shown on the map.</p>
<p>For some plugins like <a href="location-plugin-here.html">Qt Location HERE Plugin</a> the search box provides search term suggestions when three or more characters are entered. Selecting one of the suggestions will cause a place search to be performed with the selected search text.</p>
<p>Clicking on a search result will display details about the place. If a places has rich content (editorials, reviews and images), these can be accessed by the buttons on the details page. To find similar places click the "Find similar" button.</p>
<p>The geo service provider can be changed by accessing the "Provider" menu.</p>
<a name="displaying-categories"></a>
<h2 id="displaying-categories">Displaying Categories</h2>
<p>Before search by category can be performed, the list of available categories needs to be retrieved. This is achieved by creating a <a href="qml-qtlocation-categorymodel.html">CategoryModel</a>.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-categorymodel.html">CategoryModel</a></span> {
<span class="name">id</span>: <span class="name">categoryModel</span>
<span class="name">hierarchical</span>: <span class="number">true</span>
}</pre>
<p>The <a href="qml-qtlocation-categorymodel.html">CategoryModel</a> type provides a model of the available categories. It can provide either a flat list or a hierarchical tree model. In this example, we use a hierarchical tree model, by setting the <a href="qml-qtlocation-categorymodel.html#hierarchical-prop">hierarchical</a> property to <i>true</i>. The <a href="qml-qtlocation-categorymodel.html#plugin-prop">plugin</a> property is set during example intalization.</p>
<p>Next we create a ListView to display the category model.</p>
<pre class="qml"><span class="type">ListView</span> {
<span class="name">id</span>: <span class="name">root</span>
property <span class="type">variant</span> <span class="name">categoryModel</span>
property <span class="type">variant</span> <span class="name">rootIndex</span>
signal <span class="type">searchCategory</span>(variant category)
signal <span class="type">showSubcategories</span>(variant index)
<span class="name">snapMode</span>: <span class="name">ListView</span>.<span class="name">SnapToItem</span>
<span class="name">model</span>: <span class="name">DelegateModel</span> {
<span class="name">id</span>: <span class="name">delegeteDataModel</span>
<span class="name">model</span>: <span class="name">root</span>.<span class="name">categoryModel</span>
<span class="name">rootIndex</span>: <span class="name">root</span>.<span class="name">rootIndex</span>
<span class="name">delegate</span>: <span class="name">CategoryDelegate</span> {
<span class="name">onSearchCategory</span>: <span class="name">root</span>.<span class="name">searchCategory</span>(<span class="name">category</span>);
<span class="name">onShowSubcategories</span>: <span class="name">root</span>.<span class="name">showSubcategories</span>(<span class="name">delegeteDataModel</span>.<span class="name">modelIndex</span>(<span class="name">index</span>))
}
}
}</pre>
<p>Because a hierarchical model is being used, a DelegateModel is needed to provide navigation functionality. If flat list model was being used the view could use the <a href="qml-qtlocation-categorymodel.html">CategoryModel</a> directly.</p>
<p>The <i>rootIndex</i> property sets the root index of the DelegateModel. Categories are displayed by the <i>CategoryDelegate</i>, which provides two signals. The <i>onShowSubcategories</i> emits the <b>showSubcategories()</b> signal with root index to the current index causing the sub categories of the selected category to be displayed. The <i>onSearchCategory</i> handler emits the <b>searchCategory()</b> signal with a category parameter indicating which specific category has been chosen.</p>
<p>The <i>CategoryDelegate</i> displays the category name and emits the <b>searchCategory()</b> signal when the Label is clicked:</p>
<pre class="qml"><span class="type">Label</span> {
<span class="name">id</span>: <span class="name">labelItem</span>
<span class="name">text</span>: <span class="name">category</span>.<span class="name">name</span>
<span class="name">anchors</span>.left: <span class="name">icon</span>.<span class="name">right</span>
<span class="name">anchors</span>.verticalCenter: <span class="name">parent</span>.<span class="name">verticalCenter</span>
<span class="name">anchors</span>.right: <span class="name">arrow</span>.<span class="name">left</span>
}
<span class="type">MouseArea</span> {
<span class="name">id</span>: <span class="name">mouse</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">root</span>.<span class="name">searchCategory</span>()
}</pre>
<p>The <i>CategoryDelegate</i> also displays <i>arrow</i> ToolButton when <i>hasModelChildren</i> property is set.</p>
<pre class="qml"><span class="type">ToolButton</span> {
<span class="name">id</span>: <span class="name">arrow</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">anchors</span>.verticalCenter: <span class="name">parent</span>.<span class="name">verticalCenter</span>
<span class="name">anchors</span>.rightMargin: <span class="number">15</span>
<span class="name">visible</span>: <span class="name">model</span>.<span class="name">hasModelChildren</span>
<span class="name">iconSource</span>: <span class="string">"../../resources/right.png"</span>
<span class="name">onClicked</span>: <span class="name">root</span>.<span class="name">showSubcategories</span>()
}</pre>
<a name="presenting-search-suggestions"></a><a name="presenting-search-suggestions"></a>
<h2 id="presenting-search-suggestions">Presenting Search Suggestions</h2>
<p>The <a href="qml-qtlocation-placesearchsuggestionmodel.html">PlaceSearchSuggestionModel</a> type is used to fetch suggested search terms based on a partially entered search term.</p>
<p>A new suggestion search is triggered whenever the entered search term is changed.</p>
<pre class="qml"><span class="type">SearchBar</span> {
<span class="name">id</span>: <span class="name">searchBar</span>
<span class="name">onSearchTextChanged</span>: {
<span class="keyword">if</span> (<span class="name">searchText</span>.<span class="name">length</span> <span class="operator">>=</span> <span class="number">3</span> <span class="operator">&&</span> <span class="name">suggestionModel</span> <span class="operator">!=</span> <span class="number">null</span>) {
<span class="name">suggestionModel</span>.<span class="name">searchTerm</span> <span class="operator">=</span> <span class="name">searchText</span>;
<span class="name">suggestionModel</span>.<span class="name">update</span>();
}
}
}</pre>
<p>Suggestions are only queried if the length of the search term is three or more characters.</p>
<p>When the status of the <a href="qml-qtlocation-placesearchsuggestionmodel.html">PlaceSearchSuggestionModel</a> changes, search suggestions are displayed.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-placesearchsuggestionmodel.html">PlaceSearchSuggestionModel</a></span> {
<span class="name">id</span>: <span class="name">suggestionModel</span>
<span class="name">searchArea</span>: <span class="name">searchRegion</span>
<span class="name">onStatusChanged</span>: {
<span class="keyword">if</span> (<span class="name">status</span> <span class="operator">==</span> <span class="name">PlaceSearchSuggestionModel</span>.<span class="name">Ready</span>)
<span class="name">stackView</span>.<span class="name">showSuggestions</span>()
}
}</pre>
<p>The main object in the "SuggestionsShown" state is the ListView showing the search suggestions.</p>
<pre class="qml"><span class="type">ListView</span> {
<span class="name">id</span>: <span class="name">suggestionView</span>
property <span class="type">variant</span> <span class="name">suggestionModel</span>
signal <span class="type">suggestionSelected</span>(string text)
<span class="name">model</span>: <span class="name">suggestionModel</span>
<span class="name">delegate</span>: <span class="name">Item</span> {
<span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
<span class="name">height</span>: <span class="name">label</span>.<span class="name">height</span> <span class="operator">*</span> <span class="number">1.5</span>
<span class="type">Label</span> {
<span class="name">id</span>: <span class="name">label</span>
<span class="name">text</span>: <span class="name">suggestion</span>
}
<span class="type">MouseArea</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">suggestionSelected</span>(<span class="name">suggestion</span>)
}
}
}</pre>
<p>A Label object is used as the delegate to display the suggestion text. Clicking on the suggested search term updates the search term and triggers a place search using the search suggestion.</p>
<a name="searching-for-places"></a>
<h2 id="searching-for-places">Searching for Places</h2>
<p>The <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a> type is used to search for places.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a></span> {
<span class="name">id</span>: <span class="name">placeSearchModel</span>
<span class="name">searchArea</span>: <span class="name">searchRegion</span>
<span class="keyword">function</span> <span class="name">searchForCategory</span>(<span class="name">category</span>) {
<span class="name">searchTerm</span> <span class="operator">=</span> <span class="string">""</span>;
<span class="name">categories</span> <span class="operator">=</span> <span class="name">category</span>;
<span class="name">recommendationId</span> <span class="operator">=</span> <span class="string">""</span>;
<span class="name">searchArea</span> <span class="operator">=</span> <span class="name">searchRegion</span>
<span class="name">limit</span> <span class="operator">=</span> -<span class="number">1</span>;
<span class="name">update</span>();
}
<span class="keyword">function</span> <span class="name">searchForText</span>(<span class="name">text</span>) {
<span class="name">searchTerm</span> <span class="operator">=</span> <span class="name">text</span>;
<span class="name">categories</span> <span class="operator">=</span> <span class="number">null</span>;
<span class="name">recommendationId</span> <span class="operator">=</span> <span class="string">""</span>;
<span class="name">searchArea</span> <span class="operator">=</span> <span class="name">searchRegion</span>
<span class="name">limit</span> <span class="operator">=</span> -<span class="number">1</span>;
<span class="name">update</span>();
}
<span class="keyword">function</span> <span class="name">searchForRecommendations</span>(<span class="name">placeId</span>) {
<span class="name">searchTerm</span> <span class="operator">=</span> <span class="string">""</span>;
<span class="name">categories</span> <span class="operator">=</span> <span class="number">null</span>;
<span class="name">recommendationId</span> <span class="operator">=</span> <span class="name">placeId</span>;
<span class="name">searchArea</span> <span class="operator">=</span> <span class="number">null</span>;
<span class="name">limit</span> <span class="operator">=</span> -<span class="number">1</span>;
<span class="name">update</span>();
}
<span class="name">onStatusChanged</span>: {
<span class="keyword">switch</span> (<span class="name">status</span>) {
<span class="keyword">case</span> <span class="name">PlaceSearchModel</span>.<span class="name">Ready</span>:
<span class="keyword">if</span> (<span class="name">count</span> <span class="operator">></span> <span class="number">0</span>)
<span class="name">stackView</span>.<span class="name">showPlaces</span>()
<span class="keyword">else</span>
<span class="name">stackView</span>.<span class="name">showMessage</span>(<span class="name">qsTr</span>(<span class="string">"Search Place Error"</span>),<span class="name">qsTr</span>(<span class="string">"Place not found !"</span>))
<span class="keyword">break</span>;
<span class="keyword">case</span> <span class="name">PlaceSearchModel</span>.<span class="name">Error</span>:
<span class="name">stackView</span>.<span class="name">showMessage</span>(<span class="name">qsTr</span>(<span class="string">"Search Place Error"</span>),<span class="name">errorString</span>())
<span class="keyword">break</span>;
}
}
}</pre>
<p>First some of the model's properties are set, which will be used to form the search request. The <a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a> property is set to the <i>searchRegion</i> object which is a <a href="../qtcore/qt.html#modal">geocircle</a> with a center that is linked to the current location displayed on the <a href="qml-qtlocation-map.html">Map</a>.</p>
<p>Finally, we define three helper functions <b>searchForCategory()</b>, <b>searchForText()</b> and <b>searchForRecommendations()</b> which set either the <a href="qml-qtlocation-placesearchmodel.html#categories-prop">categories</a> or <a href="qml-qtlocation-placesearchmodel.html#searchTerm-prop">searchTerm</a> or <a href="qml-qtlocation-placesearchmodel.html#recommendationId-prop">recommendationId</a> properties and invokes the <a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> method to start the place search. The search results are displayed in a ListView.</p>
<pre class="qml"><span class="type">ListView</span> {
<span class="name">id</span>: <span class="name">searchView</span>
<span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
<span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
property <span class="type">variant</span> <span class="name">placeSearchModel</span>
signal <span class="type">showPlaceDetails</span>(variant place, variant distance)
signal <span class="type">showMap</span>()
<span class="name">model</span>: <span class="name">placeSearchModel</span>
<span class="name">delegate</span>: <span class="name">SearchResultDelegate</span> {
<span class="name">onShowPlaceDetails</span>: <span class="name">searchView</span>.<span class="name">showPlaceDetails</span>(<span class="name">place</span>, <span class="name">distance</span>)
<span class="name">onSearchFor</span>: <span class="name">placeSearchModel</span>.<span class="name">searchForText</span>(<span class="name">query</span>);
}
<span class="name">footer</span>:
<span class="name">RowLayout</span> {
<span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
<span class="type">Button</span> {
<span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">"Previous"</span>)
<span class="name">enabled</span>: <span class="name">placeSearchModel</span>.<span class="name">previousPagesAvailable</span>
<span class="name">onClicked</span>: <span class="name">placeSearchModel</span>.<span class="name">previousPage</span>()
<span class="name">Layout</span>.alignment: <span class="name">Qt</span>.<span class="name">AlignHCenter</span>
}
<span class="type">Button</span> {
<span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">"Clear"</span>)
<span class="name">onClicked</span>: {
<span class="name">placeSearchModel</span>.<span class="name">reset</span>()
<span class="name">showMap</span>()
}
<span class="name">Layout</span>.alignment: <span class="name">Qt</span>.<span class="name">AlignHCenter</span>
}
<span class="type">Button</span> {
<span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">"Next"</span>)
<span class="name">enabled</span>: <span class="name">placeSearchModel</span>.<span class="name">nextPagesAvailable</span>
<span class="name">onClicked</span>: <span class="name">placeSearchModel</span>.<span class="name">nextPage</span>()
<span class="name">Layout</span>.alignment: <span class="name">Qt</span>.<span class="name">AlignHCenter</span>
}
}
}</pre>
<p>The delegate used in the ListView, <i>SearchResultDelegate</i>, is designed to handle multiple search result types via a Loader object. For results of type <i>PlaceResult</i> the delegate is:</p>
<pre class="qml"><span class="type">Component</span> {
<span class="name">id</span>: <span class="name">placeComponent</span>
<span class="type">Item</span> {
<span class="name">id</span>: <span class="name">placeRoot</span>
<span class="name">width</span>: <span class="name">root</span>.<span class="name">width</span>
<span class="name">height</span>: <span class="name">Math</span>.<span class="name">max</span>(<span class="name">icon</span>.<span class="name">height</span>, <span class="number">3</span> <span class="operator">*</span> <span class="name">placeName</span>.<span class="name">height</span>)
<span class="type">Rectangle</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">color</span>: <span class="string">"#44ffffff"</span>
<span class="name">visible</span>: <span class="name">mouse</span>.<span class="name">pressed</span>
}
<span class="type">Rectangle</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">color</span>: <span class="string">"#dbffde"</span>
<span class="name">visible</span>: <span class="name">model</span>.<span class="name">sponsored</span> <span class="operator">!==</span> <span class="name">undefined</span> ? <span class="name">model</span>.<span class="name">sponsored</span> : <span class="number">false</span>
<span class="type">Label</span> {
<span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">"Sponsored result"</span>)
<span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignRight</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
<span class="name">font</span>.pixelSize: <span class="number">8</span>
<span class="name">visible</span>: <span class="name">model</span>.<span class="name">sponsored</span> <span class="operator">!==</span> <span class="name">undefined</span> ? <span class="name">model</span>.<span class="name">sponsored</span> : <span class="number">false</span>
}
}
<span class="type">GridLayout</span> {
<span class="name">rows</span>: <span class="number">2</span>
<span class="name">columns</span>: <span class="number">2</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">anchors</span>.leftMargin: <span class="number">30</span>
<span class="name">flow</span>: <span class="name">GridLayout</span>.<span class="name">TopToBottom</span>
<span class="type">Image</span> {
<span class="comment">// anchors.verticalCenter: parent.verticalCenter</span>
<span class="name">id</span>:<span class="name">icon</span>
<span class="name">source</span>: <span class="name">place</span>.<span class="name">favorite</span> ? <span class="string">"../../resources/star.png"</span> : <span class="name">place</span>.<span class="name">icon</span>.<span class="name">url</span>()
<span class="name">Layout</span>.rowSpan: <span class="number">2</span>
}
<span class="type">Label</span> {
<span class="name">id</span>: <span class="name">placeName</span>
<span class="name">text</span>: <span class="name">place</span>.<span class="name">favorite</span> ? <span class="name">place</span>.<span class="name">favorite</span>.<span class="name">name</span> : <span class="name">place</span>.<span class="name">name</span>
<span class="name">Layout</span>.fillWidth: <span class="number">true</span>
}
<span class="type">Label</span> {
<span class="name">id</span>: <span class="name">distanceText</span>
<span class="name">font</span>.italic: <span class="number">true</span>
<span class="name">text</span>: <span class="name">Helper</span>.<span class="name">formatDistance</span>(<span class="name">distance</span>)
<span class="name">Layout</span>.fillWidth: <span class="number">true</span>
}
}
<span class="type">Rectangle</span> {
<span class="name">anchors</span>.left: <span class="name">parent</span>.<span class="name">left</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">anchors</span>.margins: <span class="number">15</span>
<span class="name">height</span>: <span class="number">1</span>
<span class="name">color</span>: <span class="string">"#46a2da"</span>
}
<span class="type">MouseArea</span> {
<span class="name">id</span>: <span class="name">mouse</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: {
<span class="keyword">if</span> (<span class="name">model</span>.<span class="name">type</span> <span class="operator">===</span> <span class="name">undefined</span> <span class="operator">||</span> <span class="name">type</span> <span class="operator">===</span> <span class="name">PlaceSearchModel</span>.<span class="name">PlaceResult</span>) {
<span class="keyword">if</span> (!<span class="name">place</span>.<span class="name">detailsFetched</span>)
<span class="name">place</span>.<span class="name">getDetails</span>();
<span class="name">root</span>.<span class="name">showPlaceDetails</span>(<span class="name">model</span>.<span class="name">place</span>, <span class="name">model</span>.<span class="name">distance</span>);
}
}
}
}
}</pre>
<a name="displaying-place-content"></a>
<h2 id="displaying-place-content">Displaying Place Content</h2>
<p>Places can have additional rich content, including editorials, reviews and images. Rich content is accessed via a set of models. Content models are generally not created directly by the application developer, instead models are obtained from the <a href="qml-qtlocation-place.html#editorialModel-prop">editorialModel</a>, <a href="qml-qtlocation-place.html#reviewModel-prop">reviewModel</a> and <a href="qml-qtlocation-place.html#imageModel-prop">imageModel</a> properties of the <a href="qml-qtlocation-place.html">Place</a> type.</p>
<pre class="qml"><span class="type">ListView</span> {
<span class="name">id</span>:<span class="name">view</span>
property <span class="type"><a href="qml-qtlocation-place.html">Place</a></span> <span class="name">place</span>
signal <span class="type">showEditorial</span>(variant editorial)
<span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
<span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
<span class="name">model</span>: <span class="name">place</span>.<span class="name">editorialModel</span>
<span class="name">delegate</span>: <span class="name">EditorialDelegate</span> {
<span class="name">onShowEditorial</span>: <span class="name">view</span>.<span class="name">showEditorial</span>(<span class="name">model</span>)
}
}</pre>
<p>Files:</p>
<ul>
<li><a href="qtlocation-places-helper-js.html">places/helper.js</a></li>
<li><a href="qtlocation-places-places-qml.html">places/places.qml</a></li>
<li><a href="qtlocation-places-forms-message-qml.html">places/forms/Message.qml</a></li>
<li><a href="qtlocation-places-forms-messageform-ui-qml.html">places/forms/MessageForm.ui.qml</a></li>
<li><a href="qtlocation-places-forms-placedetails-qml.html">places/forms/PlaceDetails.qml</a></li>
<li><a href="qtlocation-places-forms-placedetailsform-ui-qml.html">places/forms/PlaceDetailsForm.ui.qml</a></li>
<li><a href="qtlocation-places-forms-searchboundingbox-qml.html">places/forms/SearchBoundingBox.qml</a></li>
<li><a href="qtlocation-places-forms-searchboundingboxform-ui-qml.html">places/forms/SearchBoundingBoxForm.ui.qml</a></li>
<li><a href="qtlocation-places-forms-searchboundingcircle-qml.html">places/forms/SearchBoundingCircle.qml</a></li>
<li><a href="qtlocation-places-forms-searchboundingcircleform-ui-qml.html">places/forms/SearchBoundingCircleForm.ui.qml</a></li>
<li><a href="qtlocation-places-forms-searchcenter-qml.html">places/forms/SearchCenter.qml</a></li>
<li><a href="qtlocation-places-forms-searchcenterform-ui-qml.html">places/forms/SearchCenterForm.ui.qml</a></li>
<li><a href="qtlocation-places-forms-searchoptions-qml.html">places/forms/SearchOptions.qml</a></li>
<li><a href="qtlocation-places-forms-searchoptionsform-ui-qml.html">places/forms/SearchOptionsForm.ui.qml</a></li>
<li><a href="qtlocation-places-items-mainmenu-qml.html">places/items/MainMenu.qml</a></li>
<li><a href="qtlocation-places-items-mapcomponent-qml.html">places/items/MapComponent.qml</a></li>
<li><a href="qtlocation-places-items-searchbar-qml.html">places/items/SearchBar.qml</a></li>
<li><a href="qtlocation-places-views-categorydelegate-qml.html">places/views/CategoryDelegate.qml</a></li>
<li><a href="qtlocation-places-views-categoryview-qml.html">places/views/CategoryView.qml</a></li>
<li><a href="qtlocation-places-views-editorialdelegate-qml.html">places/views/EditorialDelegate.qml</a></li>
<li><a href="qtlocation-places-views-editorialpage-qml.html">places/views/EditorialPage.qml</a></li>
<li><a href="qtlocation-places-views-editorialview-qml.html">places/views/EditorialView.qml</a></li>
<li><a href="qtlocation-places-views-imageview-qml.html">places/views/ImageView.qml</a></li>
<li><a href="qtlocation-places-views-ratingview-qml.html">places/views/RatingView.qml</a></li>
<li><a href="qtlocation-places-views-reviewdelegate-qml.html">places/views/ReviewDelegate.qml</a></li>
<li><a href="qtlocation-places-views-reviewpage-qml.html">places/views/ReviewPage.qml</a></li>
<li><a href="qtlocation-places-views-reviewview-qml.html">places/views/ReviewView.qml</a></li>
<li><a href="qtlocation-places-views-searchresultdelegate-qml.html">places/views/SearchResultDelegate.qml</a></li>
<li><a href="qtlocation-places-views-searchresultview-qml.html">places/views/SearchResultView.qml</a></li>
<li><a href="qtlocation-places-views-suggestionview-qml.html">places/views/SuggestionView.qml</a></li>
<li><a href="qtlocation-places-main-cpp.html">places/main.cpp</a></li>
<li><a href="qtlocation-places-places-pro.html">places/places.pro</a></li>
<li><a href="qtlocation-places-places-qrc.html">places/places.qrc</a></li>
</ul>
</div>
<!-- @@@places -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</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>
|