/usr/share/qt5/doc/qtqml/qqmlpropertymap.html is in qtdeclarative5-doc-html 5.2.1-3ubuntu15.
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 | <?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" />
<!-- qqmlpropertymap.cpp -->
<title>QQmlPropertyMap Class | QtQml 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="qtqml-index.html">Qt QML</a></li>
<li><a href="qtqml-module.html">C++ Classes</a></li>
<li>QQmlPropertyMap</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="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QQmlPropertyMap Class</h1>
<!-- $$$QQmlPropertyMap-brief -->
<p>The QQmlPropertyMap class allows you to set key-value pairs that can be used in QML bindings. <a href="#details">More...</a></p>
<!-- @@@QQmlPropertyMap -->
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> </b><tt><span class="preprocessor">#include <QQmlPropertyMap></span>
</tt></td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> <tt>QT += qml</tt></td></tr></table><ul>
<li><a href="qqmlpropertymap-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="qqmlpropertymap.html#QQmlPropertyMap">QQmlPropertyMap</a></b>(QObject *<i> parent</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#dtor.QQmlPropertyMap">~QQmlPropertyMap</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#clear">clear</a></b>(const QString &<i> key</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#contains">contains</a></b>(const QString &<i> key</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#count">count</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#insert">insert</a></b>(const QString &<i> key</i>, const QVariant &<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#isEmpty">isEmpty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#keys">keys</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#value">value</a></b>(const QString &<i> key</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant & </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#operator-5b-5d">operator[]</a></b>(const QString &<i> key</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#operator-5b-5d-2">operator[]</a></b>(const QString &<i> key</i>) const</td></tr>
</table>
<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="qqmlpropertymap.html#valueChanged">valueChanged</a></b>(const QString &<i> key</i>, const QVariant &<i> value</i>)</td></tr>
</table>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#QQmlPropertyMap-2">QQmlPropertyMap</a></b>(DerivedType *<i> derived</i>, QObject *<i> parent</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#updateValue">updateValue</a></b>(const QString &<i> key</i>, const QVariant &<i> input</i>)</td></tr>
</table>
<a name="details"></a>
<!-- $$$QQmlPropertyMap-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QQmlPropertyMap class allows you to set key-value pairs that can be used in QML bindings.</p>
<p>QQmlPropertyMap 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">QQmlPropertyMap</span> ownerData;
ownerData<span class="operator">.</span><a href="qqmlpropertymap.html#insert">insert</a>(<span class="string">"name"</span><span class="operator">,</span> <span class="type">QVariant</span>(<span class="type">QString</span>(<span class="string">"John Smith"</span>)));
ownerData<span class="operator">.</span><a href="qqmlpropertymap.html#insert">insert</a>(<span class="string">"phone"</span><span class="operator">,</span> <span class="type">QVariant</span>(<span class="type">QString</span>(<span class="string">"555-5555"</span>)));
<span class="comment">// expose it to the UI layer</span>
<span class="type">QQuickView</span> view;
<span class="type"><a href="qqmlcontext.html">QQmlContext</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">></span>setContextProperty(<span class="string">"owner"</span><span class="operator">,</span> <span class="operator">&</span>ownerData);
view<span class="operator">.</span>setSource(<span class="type">QUrl</span><span class="operator">::</span>fromLocalFile(<span class="string">"main.qml"</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">" "</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="qqmlpropertymap.html#valueChanged">valueChanged</a>() signal. However, note that <a href="qqmlpropertymap.html#valueChanged">valueChanged</a>() is <b>NOT</b> emitted when changes are made by calling <a href="qqmlpropertymap.html#insert">insert</a>() or <a href="qqmlpropertymap.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><p><b>Note: </b>When deriving a class from QQmlPropertyMap, use the protected two-argument constructor which ensures that the class is correctly registered with the Qt Meta-Object System.</p></div>
<!-- @@@QQmlPropertyMap -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QQmlPropertyMap[overload1]$$$QQmlPropertyMapQObject* -->
<h3 class="fn"><a name="QQmlPropertyMap"></a>QQmlPropertyMap::<span class="name">QQmlPropertyMap</span>(<span class="type">QObject</span> *<i> parent</i> = 0)</h3>
<p>Constructs a bindable map with parent object <i>parent</i>.</p>
<!-- @@@QQmlPropertyMap -->
<!-- $$$QQmlPropertyMap$$$QQmlPropertyMapDerivedType*QObject* -->
<h3 class="fn"><a name="QQmlPropertyMap-2"></a>QQmlPropertyMap::<span class="name">QQmlPropertyMap</span>(<span class="type">DerivedType</span> *<i> derived</i>, <span class="type">QObject</span> *<i> parent</i>)<tt> [protected]</tt></h3>
<p>Constructs a bindable map with parent object <i>parent</i>. Use this constructor in classes derived from <a href="qqmlpropertymap.html">QQmlPropertyMap</a>.</p>
<p>The type of <i>derived</i> is used to register the property map with the Meta-Object System, which is necessary to ensure that properties of the derived class are accessible. This type must be derived from <a href="qqmlpropertymap.html">QQmlPropertyMap</a>.</p>
<!-- @@@QQmlPropertyMap -->
<!-- $$$~QQmlPropertyMap[overload1]$$$~QQmlPropertyMap -->
<h3 class="fn"><a name="dtor.QQmlPropertyMap"></a>QQmlPropertyMap::<span class="name">~QQmlPropertyMap</span>()<tt> [virtual]</tt></h3>
<p>Destroys the bindable map.</p>
<!-- @@@~QQmlPropertyMap -->
<!-- $$$clear[overload1]$$$clearconstQString& -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QQmlPropertyMap::<span class="name">clear</span>(const <span class="type">QString</span> &<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> QQmlPropertyMap::<span class="name">contains</span>(const <span class="type">QString</span> &<i> key</i>) const</h3>
<p>Returns true if the map contains <i>key</i>.</p>
<p><b>See also </b><a href="qqmlpropertymap.html#size">size</a>().</p>
<!-- @@@contains -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type">int</span> QQmlPropertyMap::<span class="name">count</span>() const</h3>
<p>This is an overloaded function.</p>
<p>Same as <a href="qqmlpropertymap.html#size">size</a>().</p>
<!-- @@@count -->
<!-- $$$insert[overload1]$$$insertconstQString&constQVariant& -->
<h3 class="fn"><a name="insert"></a><span class="type">void</span> QQmlPropertyMap::<span class="name">insert</span>(const <span class="type">QString</span> &<i> key</i>, const <span class="type">QVariant</span> &<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> QQmlPropertyMap::<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="qqmlpropertymap.html#size">size</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$keys[overload1]$$$keys -->
<h3 class="fn"><a name="keys"></a><span class="type">QStringList</span> QQmlPropertyMap::<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 QVariants.</p>
<!-- @@@keys -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type">int</span> QQmlPropertyMap::<span class="name">size</span>() const</h3>
<p>Returns the number of keys in the map.</p>
<p><b>See also </b><a href="qqmlpropertymap.html#isEmpty">isEmpty</a>() and <a href="qqmlpropertymap.html#count">count</a>().</p>
<!-- @@@size -->
<!-- $$$updateValue[overload1]$$$updateValueconstQString&constQVariant& -->
<h3 class="fn"><a name="updateValue"></a><span class="type">QVariant</span> QQmlPropertyMap::<span class="name">updateValue</span>(const <span class="type">QString</span> &<i> key</i>, const <span class="type">QVariant</span> &<i> input</i>)<tt> [virtual protected]</tt></h3>
<p>Returns the new value to be stored for the key <i>key</i>. This function is provided to intercept updates to a property from QML, where the value provided from QML is <i>input</i>.</p>
<p>Override this function to manipulate the property value as it is updated. Note that this function is only invoked when the value is updated from QML.</p>
<!-- @@@updateValue -->
<!-- $$$value[overload1]$$$valueconstQString& -->
<h3 class="fn"><a name="value"></a><span class="type">QVariant</span> QQmlPropertyMap::<span class="name">value</span>(const <span class="type">QString</span> &<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 QVariant is returned.</p>
<!-- @@@value -->
<!-- $$$valueChanged[overload1]$$$valueChangedconstQString&constQVariant& -->
<h3 class="fn"><a name="valueChanged"></a><span class="type">void</span> QQmlPropertyMap::<span class="name">valueChanged</span>(const <span class="type">QString</span> &<i> key</i>, const <span class="type">QVariant</span> &<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="qqmlpropertymap.html#insert">insert</a>() or <a href="qqmlpropertymap.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">QVariant</span> & QQmlPropertyMap::<span class="name">operator[]</span>(const <span class="type">QString</span> &<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 QVariant into the map with key <i>key</i>, and returns a reference to it.</p>
<p><b>See also </b><a href="qqmlpropertymap.html#insert">insert</a>() and <a href="qqmlpropertymap.html#value">value</a>().</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]constQString& -->
<h3 class="fn"><a name="operator-5b-5d-2"></a><span class="type">QVariant</span> QQmlPropertyMap::<span class="name">operator[]</span>(const <span class="type">QString</span> &<i> key</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Same as <a href="qqmlpropertymap.html#value">value</a>().</p>
<!-- @@@operator[] -->
</div>
</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>
|