/usr/share/qt5/doc/qtqml/qqmlpropertymap.html is in qtdeclarative5-doc-html 5.9.5-0ubuntu1.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qqmlpropertymap.cpp -->
<title>QQmlPropertyMap Class | Qt QML 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="qtqml-index.html">Qt QML</a></td><td ><a href="qtqml-module.html">C++ Classes</a></td><td >QQmlPropertyMap</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 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="#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>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QQmlPropertyMap Class</h1>
<!-- $$$QQmlPropertyMap-brief -->
<p>The <a href="qqmlpropertymap.html">QQmlPropertyMap</a> class allows you to set key-value pairs that can be used in QML bindings. <a href="#details">More...</a></p>
<!-- @@@QQmlPropertyMap -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QQmlPropertyMap></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += qml</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qqmlpropertymap-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><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> = Q_NULLPTR)</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-1">operator[]</a></b>(const QString &<i>key</i>) const</td></tr>
</table></div>
<ul>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><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></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qqmlpropertymap.html#QQmlPropertyMap-1">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></div>
<ul>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QQmlPropertyMap-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qqmlpropertymap.html">QQmlPropertyMap</a> class allows you to set key-value pairs that can be used in QML bindings.</p>
<p><a href="qqmlpropertymap.html">QQmlPropertyMap</a> 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"><a href="qqmlpropertymap.html#QQmlPropertyMap">QQmlPropertyMap</a></span> ownerData;
ownerData<span class="operator">.</span>insert(<span class="string">"name"</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>(<span class="type"><a href="../qtcore/qstring.html">QString</a></span>(<span class="string">"John Smith"</span>)));
ownerData<span class="operator">.</span>insert(<span class="string">"phone"</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>(<span class="type"><a href="../qtcore/qstring.html">QString</a></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"><a href="../qtcore/qurl.html">QUrl</a></span><span class="operator">::</span>fromLocalFile(<span class="string">"main.qml"</span>));
view<span class="operator">.</span>show();
</pre>
<p>Then, in <code>main.qml</code>:</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 <a href="qqmlpropertymap.html">QQmlPropertyMap</a>, use the <a href="qqmlpropertymap.html#QQmlPropertyMap-1">protected two-argument constructor</a> which ensures that the class is correctly registered with the Qt <a href="../qtcore/metaobjects.html">Meta-Object System</a>.</p></div>
<!-- @@@QQmlPropertyMap -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QQmlPropertyMap[overload1]$$$QQmlPropertyMapQObject* -->
<h3 class="fn" id="QQmlPropertyMap"><a name="QQmlPropertyMap"></a>QQmlPropertyMap::<span class="name">QQmlPropertyMap</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a bindable map with parent object <i>parent</i>.</p>
<!-- @@@QQmlPropertyMap -->
<!-- $$$QQmlPropertyMap$$$QQmlPropertyMapDerivedType*QObject* -->
<h3 class="fn" id="QQmlPropertyMap-1"><a name="QQmlPropertyMap-1"></a><code>[protected] </code>QQmlPropertyMap::<span class="name">QQmlPropertyMap</span>(<span class="type">DerivedType</span> *<i>derived</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i>)</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 <a href="../qtcore/metaobjects.html">Meta-Object System</a>, 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" id="dtor.QQmlPropertyMap"><a name="dtor.QQmlPropertyMap"></a><code>[virtual] </code>QQmlPropertyMap::<span class="name">~QQmlPropertyMap</span>()</h3>
<p>Destroys the bindable map.</p>
<!-- @@@~QQmlPropertyMap -->
<!-- $$$clear[overload1]$$$clearconstQString& -->
<h3 class="fn" id="clear"><a name="clear"></a><span class="type">void</span> QQmlPropertyMap::<span class="name">clear</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>key</i>)</h3>
<p>Clears the value (if any) associated with <i>key</i>.</p>
<!-- @@@clear -->
<!-- $$$contains[overload1]$$$containsconstQString& -->
<h3 class="fn" id="contains"><a name="contains"></a><span class="type">bool</span> QQmlPropertyMap::<span class="name">contains</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></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" id="count"><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" id="insert"><a name="insert"></a><span class="type">void</span> QQmlPropertyMap::<span class="name">insert</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>key</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></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" id="isEmpty"><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" id="keys"><a name="keys"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></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" id="size"><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" id="updateValue"><a name="updateValue"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QQmlPropertyMap::<span class="name">updateValue</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>key</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &<i>input</i>)</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" id="value"><a name="value"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QQmlPropertyMap::<span class="name">value</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></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 <a href="../qtcore/qvariant.html">QVariant</a> is returned.</p>
<!-- @@@value -->
<!-- $$$valueChanged[overload1]$$$valueChangedconstQString&constQVariant& -->
<h3 class="fn" id="valueChanged"><a name="valueChanged"></a><code>[signal] </code><span class="type">void</span> QQmlPropertyMap::<span class="name">valueChanged</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>key</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &<i>value</i>)</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" id="operator-5b-5d"><a name="operator-5b-5d"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &QQmlPropertyMap::<span class="name">operator[]</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></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 <a href="../qtcore/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="qqmlpropertymap.html#insert">insert</a>() and <a href="qqmlpropertymap.html#value">value</a>().</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]constQString& -->
<h3 class="fn" id="operator-5b-5d-1"><a name="operator-5b-5d-1"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QQmlPropertyMap::<span class="name">operator[]</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></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> 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>
|