Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > ed56237261fa5ad3d1f8082a5fac7e2e > files > 78

qtlocation5-doc-5.9.4-1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdeclarativeplaceattribute.cpp -->
  <title>ExtendedAttributes QML Type | Qt Location 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtlocation-index.html">Qt Location</a></td><td ><a href="qtlocation-qmlmodule.html">QML Types</a></td><td >ExtendedAttributes QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </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="#signals">Signals</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">ExtendedAttributes QML Type</h1>
<span class="subtitle"></span>
<!-- $$$ExtendedAttributes-brief -->
<p>The <a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> type holds additional data about a <a href="qml-qtlocation-place.html">Place</a>. <a href="#details">More...</a></p>
<!-- @@@ExtendedAttributes -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtLocation 5.3</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt Location 5.5</td></tr></table></div><ul>
<li><a href="qml-qtlocation-extendedattributes-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtlocation-extendedattributes.html#valueChanged-signal">valueChanged</a></b></b>(string <i>key</i>, variant <i>value</i>)</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">variant <b><b><a href="qml-qtlocation-extendedattributes.html#keys-method">keys</a></b></b>()</li>
</ul>
<!-- $$$ExtendedAttributes-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> type is a map of <a href="qml-qtlocation-placeattribute.html">PlaceAttributes</a>. To access attributes in the map use the <a href="qml-qtlocation-extendedattributes.html#keys-method">keys()</a> method to get the list of keys stored in the map and use the <code>[]</code> operator to access the <a href="qml-qtlocation-placeattribute.html">PlaceAttribute</a> items.</p>
<p>The following are standard keys that are defined by the API. <a href="location-places-qml.html#plugin">Plugin</a> implementations are free to define additional keys. Custom keys should be qualified by a unique prefix to avoid clashes.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >key</th><th >description</th></tr></thead>
<tr valign="top" class="odd"><td >openingHours</td><td >The trading hours of the place</td></tr>
<tr valign="top" class="even"><td >payment</td><td >The types of payment the place accepts, for example visa, mastercard.</td></tr>
<tr valign="top" class="odd"><td >x_provider</td><td >The name of the provider that a place is sourced from</td></tr>
<tr valign="top" class="even"><td >x_id_&lt;provider&gt; (for example x_id_here)</td><td >An alternative identifier which identifies the place from the perspective of the specified provider.</td></tr>
</table></div>
<p>Some plugins may not support attributes at all, others may only support a certain set, others still may support a dynamically changing set of attributes over time or even allow attributes to be arbitrarily defined by the client application. The attributes could also vary on a place by place basis, for example one place may have opening hours while another does not. Consult the <a href="qtlocation-index.html#plugin-references-and-parameters">plugin references</a> for details.</p>
<p>Some attributes may not be intended to be readable by end users, the label field of such attributes is empty to indicate this fact.</p>
<p><b>Note: </b><a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> instances are only ever used in the context of <a href="qml-qtlocation-place.html">Place</a>s. It is not possible to create an <a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> instance directly or re-assign a <a href="qml-qtlocation-place.html">Place</a>'s <a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> property. Modification of <a href="qml-qtlocation-extendedattributes.html">ExtendedAttributes</a> can only be accomplished via Javascript.</p><p>The following example shows how to access all <a href="qml-qtlocation-placeattribute.html">PlaceAttributes</a> and print them to the console:</p>
<pre class="qml">

  import QtPositioning 5.5
  import QtLocation 5.6

  <span class="keyword">function</span> <span class="name">printExtendedAttributes</span>(<span class="name">extendedAttributes</span>) {
      var <span class="name">keys</span> = <span class="name">extendedAttributes</span>.<span class="name">keys</span>();
      <span class="keyword">for</span> (<span class="keyword">var</span> <span class="name">i</span> = <span class="number">0</span>; <span class="name">i</span> <span class="operator">&lt;</span> <span class="name">keys</span>.<span class="name">length</span>; ++<span class="name">i</span>) {
          var <span class="name">key</span> = <span class="name">keys</span>[<span class="name">i</span>];
          <span class="keyword">if</span> (<span class="name">extendedAttributes</span>[<span class="name">key</span>].<span class="name">label</span> <span class="operator">!==</span> <span class="string">&quot;&quot;</span>)
              <span class="name">console</span>.<span class="name">log</span>(<span class="name">extendedAttributes</span>[<span class="name">key</span>].<span class="name">label</span> <span class="operator">+</span> <span class="string">&quot;: &quot;</span> <span class="operator">+</span> <span class="name">extendedAttributes</span>[<span class="name">key</span>].<span class="name">text</span>);
      }
  }

</pre>
<p>The following example shows how to assign and modify an attribute:</p>
<pre class="qml">

      <span class="comment">//assign a new attribute to a place</span>
      var <span class="name">smokingAttrib</span> = <span class="name">Qt</span>.<span class="name">createQmlObject</span>(<span class="string">'import QtLocation 5.3; PlaceAttribute {}'</span>, <span class="name">place</span>);
      <span class="name">smokingAttrib</span>.<span class="name">label</span> <span class="operator">=</span> <span class="string">&quot;Smoking Allowed&quot;</span>
      <span class="name">smokingAttrib</span>.<span class="name">text</span> <span class="operator">=</span> <span class="string">&quot;No&quot;</span>
      <span class="name">place</span>.<span class="name">extendedAttributes</span>.<span class="name">smoking</span> <span class="operator">=</span> <span class="name">smokingAttrib</span>;

      <span class="comment">//modify an existing attribute</span>
      <span class="name">place</span>.<span class="name">extendedAttributes</span>.<span class="name">smoking</span>.<span class="name">text</span> <span class="operator">=</span> <span class="string">&quot;Yes&quot;</span>

</pre>
<p><b>See also </b><a href="qml-qtlocation-placeattribute.html">PlaceAttribute</a> and QQmlPropertyMap.</p>
<!-- @@@ExtendedAttributes -->
<h2>Signal Documentation</h2>
<!-- $$$valueChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="valueChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="valueChanged-signal"></a><span class="type">void</span> <span class="name">valueChanged</span>(<span class="type">string</span> <i>key</i>, <span class="type">variant</span> <i>value</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the set of attributes changes. <i>key</i> is the key corresponding to the <i>value</i> that was changed.</p>
<p>The corresponding handler is <code>onValueChanged</code>.</p>
</div></div><!-- @@@valueChanged -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$keys -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="keys-method">
<td class="tblQmlFuncNode"><p>
<a name="keys-method"></a><span class="type">variant</span> <span class="name">keys</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns an array of place attribute keys currently stored in the map.</p>
</div></div><!-- @@@keys -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 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>