Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5113

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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" />
<!-- qdeclarativepropertymap.cpp -->
  <title>Qt 4.8: QDeclarativePropertyMap Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtdeclarative.html">QtDeclarative</a></li>
<li>QDeclarativePropertyMap</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QDeclarativePropertyMap Class Reference</h1>
<!-- $$$QDeclarativePropertyMap-brief -->
<p>The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in QML bindings. <a href="#details">More...</a></p>
<!-- @@@QDeclarativePropertyMap -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QDeclarativePropertyMap&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<p>This class was introduced in Qt 4.7.</p>
<ul>
<li><a href="qdeclarativepropertymap-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#QDeclarativePropertyMap">QDeclarativePropertyMap</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#dtor.QDeclarativePropertyMap">~QDeclarativePropertyMap</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#clear">clear</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#contains">contains</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#count">count</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#insert">insert</a></b> ( const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#keys">keys</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#value">value</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant &amp; </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#operator-5b-5d">operator[]</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#operator-5b-5d-2">operator[]</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdeclarativepropertymap.html#valueChanged">valueChanged</a></b> ( const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QDeclarativePropertyMap-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in QML bindings.</p>
<p>QDeclarativePropertyMap provides a convenient way to expose domain data to the UI layer. The following example shows how you might declare data in C++ and then access it in QML.</p>
<p>In the C++ file:</p>
<pre class="cpp"> <span class="comment">// create our data</span>
 <span class="type">QDeclarativePropertyMap</span> ownerData;
 ownerData<span class="operator">.</span><a href="qdeclarativepropertymap.html#insert">insert</a>(<span class="string">&quot;name&quot;</span><span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span>(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;John Smith&quot;</span>)));
 ownerData<span class="operator">.</span><a href="qdeclarativepropertymap.html#insert">insert</a>(<span class="string">&quot;phone&quot;</span><span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span>(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;555-5555&quot;</span>)));

 <span class="comment">// expose it to the UI layer</span>
 <span class="type"><a href="qdeclarativeview.html">QDeclarativeView</a></span> view;
 <span class="type"><a href="qdeclarativecontext.html">QDeclarativeContext</a></span> <span class="operator">*</span>ctxt <span class="operator">=</span> view<span class="operator">.</span>rootContext();
 ctxt<span class="operator">-</span><span class="operator">&gt;</span>setContextProperty(<span class="string">&quot;owner&quot;</span><span class="operator">,</span> <span class="operator">&amp;</span>ownerData);

 view<span class="operator">.</span>setSource(<span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">::</span>fromLocalFile(<span class="string">&quot;main.qml&quot;</span>));
 view<span class="operator">.</span>show();</pre>
<p>Then, in <tt>main.qml</tt>:</p>
<pre class="cpp"> Text { text: owner<span class="operator">.</span>name <span class="operator">+</span> <span class="string">&quot; &quot;</span> <span class="operator">+</span> owner<span class="operator">.</span>phone }</pre>
<p>The binding is dynamic - whenever a key's value is updated, anything bound to that key will be updated as well.</p>
<p>To detect value changes made in the UI layer you can connect to the <a href="qdeclarativepropertymap.html#valueChanged">valueChanged</a>() signal. However, note that <a href="qdeclarativepropertymap.html#valueChanged">valueChanged</a>() is <b>NOT</b> emitted when changes are made by calling <a href="qdeclarativepropertymap.html#insert">insert</a>() or <a href="qdeclarativepropertymap.html#clear">clear</a>() - it is only emitted when a value is updated from QML.</p>
<p><b>Note:</b> It is not possible to remove keys from the map; once a key has been added, you can only modify or clear its associated value.</p>
</div>
<!-- @@@QDeclarativePropertyMap -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QDeclarativePropertyMap[overload1]$$$QDeclarativePropertyMapQObject* -->
<h3 class="fn"><a name="QDeclarativePropertyMap"></a>QDeclarativePropertyMap::<span class="name">QDeclarativePropertyMap</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a bindable map with parent object <i>parent</i>.</p>
<!-- @@@QDeclarativePropertyMap -->
<!-- $$$~QDeclarativePropertyMap[overload1]$$$~QDeclarativePropertyMap -->
<h3 class="fn"><a name="dtor.QDeclarativePropertyMap"></a>QDeclarativePropertyMap::<span class="name">~QDeclarativePropertyMap</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the bindable map.</p>
<!-- @@@~QDeclarativePropertyMap -->
<!-- $$$clear[overload1]$$$clearconstQString& -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QDeclarativePropertyMap::<span class="name">clear</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> )</h3>
<p>Clears the value (if any) associated with <i>key</i>.</p>
<!-- @@@clear -->
<!-- $$$contains[overload1]$$$containsconstQString& -->
<h3 class="fn"><a name="contains"></a><span class="type">bool</span> QDeclarativePropertyMap::<span class="name">contains</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>Returns true if the map contains <i>key</i>.</p>
<p><b>See also </b><a href="qdeclarativepropertymap.html#size">size</a>().</p>
<!-- @@@contains -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type">int</span> QDeclarativePropertyMap::<span class="name">count</span> () const</h3>
<p>This is an overloaded function.</p>
<p>Same as <a href="qdeclarativepropertymap.html#size">size</a>().</p>
<!-- @@@count -->
<!-- $$$insert[overload1]$$$insertconstQString&constQVariant& -->
<h3 class="fn"><a name="insert"></a><span class="type">void</span> QDeclarativePropertyMap::<span class="name">insert</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &amp; <i>value</i> )</h3>
<p>Sets the value associated with <i>key</i> to <i>value</i>.</p>
<p>If the key doesn't exist, it is automatically created.</p>
<!-- @@@insert -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> QDeclarativePropertyMap::<span class="name">isEmpty</span> () const</h3>
<p>Returns true if the map contains no keys; otherwise returns false.</p>
<p><b>See also </b><a href="qdeclarativepropertymap.html#size">size</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$keys[overload1]$$$keys -->
<h3 class="fn"><a name="keys"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QDeclarativePropertyMap::<span class="name">keys</span> () const</h3>
<p>Returns the list of keys.</p>
<p>Keys that have been cleared will still appear in this list, even though their associated values are invalid <a href="qtwebkit-bridge.html#qvariants">QVariants</a>.</p>
<!-- @@@keys -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type">int</span> QDeclarativePropertyMap::<span class="name">size</span> () const</h3>
<p>Returns the number of keys in the map.</p>
<p><b>See also </b><a href="qdeclarativepropertymap.html#isEmpty">isEmpty</a>() and <a href="qdeclarativepropertymap.html#count">count</a>().</p>
<!-- @@@size -->
<!-- $$$value[overload1]$$$valueconstQString& -->
<h3 class="fn"><a name="value"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QDeclarativePropertyMap::<span class="name">value</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>Returns the value associated with <i>key</i>.</p>
<p>If no value has been set for this key (or if the value has been cleared), an invalid <a href="qvariant.html">QVariant</a> is returned.</p>
<!-- @@@value -->
<!-- $$$valueChanged[overload1]$$$valueChangedconstQString&constQVariant& -->
<h3 class="fn"><a name="valueChanged"></a><span class="type">void</span> QDeclarativePropertyMap::<span class="name">valueChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &amp; <i>value</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever one of the values in the map is changed. <i>key</i> is the key corresponding to the <i>value</i> that was changed.</p>
<p><b>Note:</b> valueChanged() is <b>NOT</b> emitted when changes are made by calling <a href="qdeclarativepropertymap.html#insert">insert</a>() or <a href="qdeclarativepropertymap.html#clear">clear</a>() - it is only emitted when a value is updated from QML.</p>
<!-- @@@valueChanged -->
<!-- $$$operator[][overload1]$$$operator[]constQString& -->
<h3 class="fn"><a name="operator-5b-5d"></a><span class="type"><a href="qvariant.html">QVariant</a></span> &amp; QDeclarativePropertyMap::<span class="name">operator[]</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> )</h3>
<p>Returns the value associated with the key <i>key</i> as a modifiable reference.</p>
<p>If the map contains no item with key <i>key</i>, the function inserts an invalid <a href="qvariant.html">QVariant</a> into the map with key <i>key</i>, and returns a reference to it.</p>
<p><b>See also </b><a href="qdeclarativepropertymap.html#insert">insert</a>() and <a href="qdeclarativepropertymap.html#value">value</a>().</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]constQString& -->
<h3 class="fn"><a name="operator-5b-5d-2"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QDeclarativePropertyMap::<span class="name">operator[]</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Same as <a href="qdeclarativepropertymap.html#value">value</a>().</p>
<!-- @@@operator[] -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </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.</p>
    <br />
    <p>
      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.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      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. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>