/usr/share/qt5/doc/qtlocation/qml-qtlocation-placesearchmodel.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 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 | <?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" />
<!-- qdeclarativesearchresultmodel.cpp -->
<title>PlaceSearchModel | 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><a href="qtlocation-qmlmodule.html">QML Types</a></li>
<li>PlaceSearchModel</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level3"><a href="#search-result-types">Search Result Types</a></li>
<li class="level2"><a href="#detection-of-updated-and-removed-places">Detection of Updated and Removed Places</a></li>
<li class="level2"><a href="#example">Example</a></li>
<li class="level2"><a href="#paging">Paging</a></li>
</ul>
</div>
<h1 class="title">PlaceSearchModel</h1>
<span class="subtitle"></span>
<!-- $$$PlaceSearchModel-brief -->
<p>Provides access to place search results. <a href="#details">More...</a></p>
<!-- @@@PlaceSearchModel -->
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> </b><tt>import QtLocation 5.0</tt></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt Location 5.0</td></tr></table><ul>
<li><a href="qml-qtlocation-placesearchmodel-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#categories-prop">categories</a></b></b> : list<Category></li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#favoritesMatchParameters-prop">favoritesMatchParameters</a></b></b> : VariantMap</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#favoritesPlugin-prop">favoritesPlugin</a></b></b> : Plugin</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#plugin-prop">plugin</a></b></b> : Plugin</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#recommendationId-prop">recommendationId</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#relevanceHint-prop">relevanceHint</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a></b></b> : variant</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#searchTerm-prop">searchTerm</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a></b></b> : enum</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#visibilityScope-prop">visibilityScope</a></b></b> : enum</li>
</ul>
<a name="methods"></a>
<h2>Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#cancel-method">cancel</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#data-method">data</a></b></b>(int <i>index</i>, string <i>role</i>)</li>
<li class="fn">string <b><b><a href="qml-qtlocation-placesearchmodel.html#errorString-method">errorString</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#reset-method">reset</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#update-method">update</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtlocation-placesearchmodel.html#updateWith-method">updateWith</a></b></b>(int <i>proposedSearchIndex</i>)</li>
</ul>
<!-- $$$PlaceSearchModel-description -->
<a name="details"></a>
<h2>Detailed Description</h2>
<p>PlaceSearchModel provides a model of place search results within the <a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a>. The <a href="qml-qtlocation-placesearchmodel.html#searchTerm-prop">searchTerm</a> and <a href="qml-qtlocation-placesearchmodel.html#categories-prop">categories</a> properties can be set to restrict the search results to places matching those criteria.</p>
<p>The PlaceSearchModel returns both sponsored and <a href="http://en.wikipedia.org/wiki/Organic_search">organic search results</a>. Sponsored search results will have the <tt>sponsored</tt> role set to true.</p>
<a name="placesearchmodel-roles"></a><p>The model returns data for the following roles:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Role</th><th >Type</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >type</td><td >enum</td><td >The type of search result.</td></tr>
<tr valign="top" class="even"><td >title</td><td >string</td><td >A string describing the search result.</td></tr>
<tr valign="top" class="odd"><td >icon</td><td ><a href="location-cpp-qml.html#placeicon">PlaceIcon</a></td><td >Icon representing the search result.</td></tr>
<tr valign="top" class="even"><td >distance</td><td >real</td><td >Valid only when the <tt>type</tt> role is <tt>PlaceResult</tt>, the distance to the place from the center of the <a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a>. If no <a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a> has been specified, the distance is NaN.</td></tr>
<tr valign="top" class="odd"><td >place</td><td ><a href="qml-qtlocation-place.html">Place</a></td><td >Valid only when the <tt>type</tt> role is <tt>PlaceResult</tt>, an object representing the place.</td></tr>
<tr valign="top" class="even"><td >sponsored</td><td >bool</td><td >Valid only when the <tt>type</tt> role is <tt>PlaceResult</tt>, true if the search result is a sponsored result.</td></tr>
</table>
<a name="search-result-types"></a>
<h3>Search Result Types</h3>
<p>The <tt>type</tt> role can take on the following values:</p>
<table class="generic">
<tr valign="top" class="odd"><td >PlaceSearchModel.UnknownSearchResult</td><td >The contents of the search result are unknown.</td></tr>
<tr valign="top" class="even"><td >PlaceSearchModel.PlaceResult</td><td >The search result contains a place.</td></tr>
<tr valign="top" class="odd"><td >PlaceSearchModel.ProposedSearchResult</td><td >The search result contains a proposed search which may be relevant.</td></tr>
</table>
<p>It can often be helpful to use a Loader to create a delegate that will choose different Components based on the search result type.</p>
<pre class="qml"><span class="type">Component</span> {
<span class="name">id</span>: <span class="name">resultDelegate</span>
<span class="type">Loader</span> {
<span class="type">Component</span> {
<span class="name">id</span>: <span class="name">placeResult</span>
<span class="type">Column</span> {
<span class="type">Text</span> { <span class="name">text</span>: <span class="name">title</span> }
<span class="type">Text</span> { <span class="name">text</span>: <span class="name">place</span>.<span class="name">location</span>.<span class="name">address</span>.<span class="name">text</span> }
}
}
<span class="type">Component</span> {
<span class="name">id</span>: <span class="name">otherResult</span>
<span class="type">Text</span> { <span class="name">text</span>: <span class="name">title</span> }
}
<span class="name">sourceComponent</span>: <span class="name">type</span> <span class="operator">==</span> <span class="name">PlaceSearchModel</span>.<span class="name">PlaceResult</span> ? <span class="name">placeResult</span> :
<span class="name">otherResult</span>
}
}</pre>
<a name="detection-of-updated-and-removed-places"></a>
<h2>Detection of Updated and Removed Places</h2>
<p>The PlaceSearchModel listens for places that have been updated or removed from its plugin's backend. If it detects that a place has been updated and that place is currently present in the model, then it will call <a href="qml-qtlocation-place.html#getDetails-method">Place::getDetails</a> to refresh the details. If it detects that a place has been removed, then correspondingly the place will be removed from the model if it is currently present.</p>
<a name="example"></a>
<h2>Example</h2>
<p>The following example shows how to use the PlaceSearchModel to search for Pizza restaurants in close proximity of a given position. A <a href="qml-qtlocation-placesearchmodel.html#searchTerm-prop">searchTerm</a> and <a href="qml-qtlocation-placesearchmodel.html#searchArea-prop">searchArea</a> are provided to the model and <a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> is used to perform a lookup query. Note that the model does not incrementally fetch search results, but rather performs a single fetch when <a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> is run. The <a href="qml-qtlocation-placesearchmodel.html#count-prop">count</a> is set to the number of search results returned during the fetch.</p>
<pre class="qml">import QtQuick 2.0
import QtPositioning 5.2
import QtLocation 5.0
<span class="type">PlaceSearchModel</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="name">searchArea</span>: <span class="name">QtPositioning</span>.<span class="name">circle</span>(<span class="name">startCoordinate</span>);
<span class="name">Component</span>.onCompleted: <span class="name">update</span>()
}</pre>
<a name="paging"></a>
<h2>Paging</h2>
<p>The PlaceSearchModel API has some limited support for paging. The <a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a> and <a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a> properties can be used to access paged search results. When the <a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a> and <a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a> properties are set the search results between <a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a> and (<a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a> + <a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a> - 1) will be returned. For example, if the backend has 5 search results in total [a,b,c,d,e], an offset of 0 specifies that the first item returned in the model will be 'a'. An offset of 1 secifies that the first item in the model will be 'b' and so on. The limit specifies the maximum number of items to be returned. For example, assuming an offset of 0 and limit of 3 then a,b,c is returned. If the offset exceeds (or equals) the total number of items, then 0 results are returned in the model. Note that the API currently does not support a means to retrieve the total number of items available from the backed. Also note that support for <a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a> and <a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a> can vary according to the <a href="qml-qtlocation-placesearchmodel.html#plugin-prop">plugin</a>.</p>
<p><b>See also </b><a href="qml-qtlocation-categorymodel.html">CategoryModel</a> and <a href="qplacemanager.html">QPlaceManager</a>.</p>
<!-- @@@PlaceSearchModel -->
<h2>Property Documentation</h2>
<!-- $$$categories -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="categories-prop"></a><span class="name">categories</span> : <span class="type">list</span><<span class="type"><a href="qml-qtlocation-category.html">Category</a></span>></p></td></tr></table></div><div class="qmldoc"><p>This property holds a list of categories to be used when searching. Returned search results will be for places that match at least one of the categories.</p>
</div></div><!-- @@@categories -->
<br/>
<!-- $$$count -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="count-prop"></a><span class="name">count</span> : <span class="type">int</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the number of results the model has.</p>
<p>Note that it does not refer to the total number of search results available in the backend. The total number of search results is not currently supported by the API.</p>
</div></div><!-- @@@count -->
<br/>
<!-- $$$favoritesMatchParameters -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="favoritesMatchParameters-prop"></a><span class="name">favoritesMatchParameters</span> : <span class="type">VariantMap</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds a set of parameters used to specify how search result places are matched to favorites in the <a href="qml-qtlocation-placesearchmodel.html#favoritesPlugin-prop">favoritesPlugin</a>.</p>
<p>By default the parameter map is empty and implies that the favorites plugin matches by <a href="location-places-backend.html#alternative-identifier-cross-referencing">alternative identifiers</a>. Generally, an application developer will not need to set this property.</p>
<p>In cases where the favorites plugin does not support matching by alternative identifiers, then the <a href="qtlocation-index.html#plugin-references-and-parameters">plugin documentation</a> should be consulted to see precisely what key-value parameters to set.</p>
</div></div><!-- @@@favoritesMatchParameters -->
<br/>
<!-- $$$favoritesPlugin -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="favoritesPlugin-prop"></a><span class="name">favoritesPlugin</span> : <span class="type"><a href="qml-qtlocation-plugin.html">Plugin</a></span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the <a href="qml-qtlocation-plugin.html">Plugin</a> which will be used to search for favorites. Any places from the search which can be cross-referenced or matched in the favoritesPlugin will have their <a href="qml-qtlocation-place.html#favorite-prop">favorite</a> property set to the corresponding <a href="qml-qtlocation-place.html">Place</a> from the favoritesPlugin.</p>
<p>If the favoritesPlugin is not set, the <a href="qml-qtlocation-place.html#favorite-prop">favorite</a> property of the places in the results will always be null.</p>
<p><b>See also </b><a href="qml-qtlocation-place.html#favorites">Favorites</a>.</p>
</div></div><!-- @@@favoritesPlugin -->
<br/>
<!-- $$$limit -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="limit-prop"></a><span class="name">limit</span> : <span class="type">int</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the limit of the number of items that will be returned.</p>
<p><b>See also </b><a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a>.</p>
</div></div><!-- @@@limit -->
<br/>
<!-- $$$offset -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="offset-prop"></a><span class="name">offset</span> : <span class="type">int</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the index of the first search result in the model.</p>
<p><b>See also </b><a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a>.</p>
</div></div><!-- @@@offset -->
<br/>
<!-- $$$plugin -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="plugin-prop"></a><span class="name">plugin</span> : <span class="type"><a href="qml-qtlocation-plugin.html">Plugin</a></span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the <a href="qml-qtlocation-plugin.html">Plugin</a> which will be used to perform the search.</p>
</div></div><!-- @@@plugin -->
<br/>
<!-- $$$recommendationId -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="recommendationId-prop"></a><span class="name">recommendationId</span> : <span class="type">string</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the placeId to be used in order to find recommendations for similar places.</p>
</div></div><!-- @@@recommendationId -->
<br/>
<!-- $$$relevanceHint -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="relevanceHint-prop"></a><span class="name">relevanceHint</span> : <span class="type">enumeration</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds a relevance hint used in the search query. The hint is given to the provider to help but not dictate the ranking of results. For example, the distance hint may give closer places a higher ranking but it does not necessarily mean the results will be strictly ordered according to distance. A provider may ignore the hint altogether.</p>
<table class="generic">
<tr valign="top" class="odd"><td >SearchResultModel.UnspecifiedHint</td><td >No relevance hint is given to the provider.</td></tr>
<tr valign="top" class="even"><td >SearchResultModel.DistanceHint</td><td >The distance of the place from the user's current location is important to the user. This hint is only meaningful when a circular search area is used.</td></tr>
<tr valign="top" class="odd"><td >SearchResultModel.LexicalPlaceNameHint</td><td >The lexical ordering of place names (in ascending alphabetical order) is relevant to the user. This hint is useful for providers based on a local data store.</td></tr>
</table>
</div></div><!-- @@@relevanceHint -->
<br/>
<!-- $$$searchArea -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="searchArea-prop"></a><span class="name">searchArea</span> : <span class="type">variant</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the search area. The search result returned by the model will be within the search area.</p>
<p>If this property is set to a geocircle its radius property may be left unset, in which case the <a href="qml-qtlocation-plugin.html">Plugin</a> will choose an appropriate radius for the search.</p>
<p>Support for specifying a search area can vary according to the <a href="qml-qtlocation-placesearchmodel.html#plugin-prop">plugin</a> backend implementation. For example, some may support a search center only while others may only support geo rectangles.</p>
</div></div><!-- @@@searchArea -->
<br/>
<!-- $$$searchTerm -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="searchTerm-prop"></a><span class="name">searchTerm</span> : <span class="type">string</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds search term used in query. The search term is a free-form text string.</p>
</div></div><!-- @@@searchTerm -->
<br/>
<!-- $$$status -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="status-prop"></a><span class="name">status</span> : <span class="type">enum</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the status of the model. It can be one of:</p>
<table class="generic">
<tr valign="top" class="odd"><td ><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Null</td><td >No search query has been executed. The model is empty.</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Ready</td><td >The search query has completed, and the results are available.</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Loading</td><td >A search query is currently being executed.</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Error</td><td >An error occurred when executing the previous search query.</td></tr>
</table>
</div></div><!-- @@@status -->
<br/>
<!-- $$$visibilityScope -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="visibilityScope-prop"></a><span class="name">visibilityScope</span> : <span class="type">enum</span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the visibility scope of the places to search. Only places with the specified visibility will be returned in the search results.</p>
<p>The visibility scope can be one of:</p>
<table class="generic">
<tr valign="top" class="odd"><td >Place.UnspecifiedVisibility</td><td >No explicit visibility scope specified, places with any visibility may be part of search results.</td></tr>
<tr valign="top" class="even"><td >Place.DeviceVisibility</td><td >Only places stored on the local device will be part of the search results.</td></tr>
<tr valign="top" class="odd"><td >Place.PrivateVisibility</td><td >Only places that are private to the current user will be part of the search results.</td></tr>
<tr valign="top" class="even"><td >Place.PublicVisibility</td><td >Only places that are public will be part of the search results.</td></tr>
</table>
</div></div><!-- @@@visibilityScope -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$cancel -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="cancel-method"></a><span class="name">cancel</span>()</p></td></tr></table></div><div class="qmldoc"><p>Cancels an ongoing search operation immediately and sets the model status to <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Ready. The model retains any search results it had before the operation was started.</p>
<p>If an operation is not ongoing, invoking cancel() has no effect.</p>
<p><b>See also </b><a href="qml-qtlocation-placesearchmodel.html#update-method">update()</a> and <a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a>.</p>
</div></div><!-- @@@cancel -->
<br/>
<!-- $$$data -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="data-method"></a><span class="name">data</span>(<span class="type">int</span><i> index</i>, <span class="type">string</span><i> role</i>)</p></td></tr></table></div><div class="qmldoc"><p>Returns the data for a given <i>role</i> at the specified row <i>index</i>.</p>
</div></div><!-- @@@data -->
<br/>
<!-- $$$errorString -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="errorString-method"></a><span class="type">string</span> <span class="name">errorString</span>() const</p></td></tr></table></div><div class="qmldoc"><p>This read-only property holds the textual presentation of latest place search model error. If no error has occurred or if the model was cleared an empty string is returned.</p>
<p>An empty string may also be returned if an error occurred which has no associated textual representation.</p>
</div></div><!-- @@@errorString -->
<br/>
<!-- $$$reset -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="reset-method"></a><span class="name">reset</span>()</p></td></tr></table></div><div class="qmldoc"><p>Resets the model. All search results are cleared, any outstanding requests are aborted and possible errors are cleared. Model status will be set to <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Null.</p>
</div></div><!-- @@@reset -->
<br/>
<!-- $$$update -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="update-method"></a><span class="name">update</span>()</p></td></tr></table></div><div class="qmldoc"><p>Updates the model based on the provided query parameters. The model will be populated with a list of places matching the search parameters specified by the type's properties. Search criteria is specified by setting properties such as the <a href="qml-qtlocation-placesearchmodel.html#searchTerm-prop">searchTerm</a>, <a href="qml-qtlocation-placesearchmodel.html#categories-prop">categories</a>, <a href="qml-qtlocation-placesearchmodel.html#limit-prop">limit</a> and <a href="qml-qtlocation-placesearchmodel.html#offset-prop">offset</a>. Support for these properties may vary according to <a href="qml-qtlocation-placesearchmodel.html#plugin-prop">plugin</a>. <tt>update()</tt> then submits the set of criteria to the <a href="qml-qtlocation-placesearchmodel.html#plugin-prop">plugin</a> to process.</p>
<p>While the model is updating the <a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a> of the model is set to <tt>PlaceSearchModel.Loading</tt>. If the model is successfully updated the <a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a> is set to <tt>PlaceSearchModel.Ready</tt>, while if it unsuccessfully completes, the <a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a> is set to <tt>PlaceSearchModel.Error</tt> and the model cleared.</p>
<pre class="cpp">PlaceSearchModel {
id: model
plugin: backendPlugin
searchArea: <span class="type">QtPositioning</span><span class="operator">.</span>circle(<span class="type">QtPositioning</span><span class="operator">.</span>coordinate(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span>))
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}
MouseArea {
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
onClicked: {
model<span class="operator">.</span>searchTerm <span class="operator">=</span> <span class="string">"pizza"</span>;
model<span class="operator">.</span>categories <span class="operator">=</span> null; <span class="comment">//not searching by any category</span>
model<span class="operator">.</span>searchArea<span class="operator">.</span>center<span class="operator">.</span>latitude <span class="operator">=</span> <span class="operator">-</span><span class="number">27.5</span>;
model<span class="operator">.</span>searchArea<span class="operator">.</span>center<span class="operator">.</span>longitude <span class="operator">=</span> <span class="number">153</span>;
model<span class="operator">.</span>update();
}
}</pre>
<p><b>See also </b><a href="qml-qtlocation-placesearchmodel.html#cancel-method">cancel()</a> and <a href="qml-qtlocation-placesearchmodel.html#status-prop">status</a>.</p>
</div></div><!-- @@@update -->
<br/>
<!-- $$$updateWith -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="updateWith-method"></a><span class="name">updateWith</span>(<span class="type">int</span><i> proposedSearchIndex</i>)</p></td></tr></table></div><div class="qmldoc"><p>Updates the model based on the ProposedSearchResult at index <i>proposedSearchIndex</i>. The model will be populated with a list of places matching the proposed search. Model status will be set to <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Loading. If the model is updated successfully status will be set to <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Ready. If an error occurs status will be set to <a href="qml-qtlocation-placesearchmodel.html">PlaceSearchModel</a>.Error and the model cleared.</p>
<p>If <i>proposedSearchIndex</i> does not reference a ProposedSearchResult this method does nothing.</p>
</div></div><!-- @@@updateWith -->
<br/>
</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>
|