/usr/share/qt5/doc/qtqml/qml-qtqml-models-delegatemodel.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 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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qqmldelegatemodel.cpp -->
<title>DelegateModel QML Type | 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-qmlmodule.html">QML Types</a></td><td >DelegateModel QML Type</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="#properties">Properties</a></li>
<li class="level1"><a href="#attached-properties">Attached Properties</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">DelegateModel QML Type</h1>
<span class="subtitle"></span>
<!-- $$$DelegateModel-brief -->
<p>Encapsulates a model and delegate <a href="#details">More...</a></p>
<!-- @@@DelegateModel -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQml.Models 2.2</td></tr></table></div><ul>
<li><a href="qml-qtqml-models-delegatemodel-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#delegate-prop">delegate</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#filterOnGroup-prop">filterOnGroup</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#groups-prop">groups</a></b></b> : list<DelegateModelGroup></li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a></b></b> : DelegateModelGroup</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#model-prop">model</a></b></b> : model</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#parts-prop">parts</a></b></b> : object</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#persistedItems-prop">persistedItems</a></b></b> : DelegateModelGroup</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a></b></b> : QModelIndex</li>
</ul>
<a name="attached-properties"></a>
<h2 id="attached-properties">Attached Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#groups-attached-prop">groups</a></b></b> : stringlist</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#inItems-attached-prop">inItems</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#inPersistedItems-attached-prop">inPersistedItems</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#isUnresolved-attached-prop">isUnresolved</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#itemsIndex-attached-prop">itemsIndex</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">model</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodel.html#persistedItemsIndex-attached-prop">persistedItemsIndex</a></b></b> : int</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">QModelIndex <b><b><a href="qml-qtqml-models-delegatemodel.html#modelIndex-method">modelIndex</a></b></b>(int <i>index</i>)</li>
<li class="fn">QModelIndex <b><b><a href="qml-qtqml-models-delegatemodel.html#parentModelIndex-method">parentModelIndex</a></b></b>()</li>
</ul>
<!-- $$$DelegateModel-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> type encapsulates a model and the delegate that will be instantiated for items in the model.</p>
<p>It is usually not necessary to create a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>. However, it can be useful for manipulating and accessing the <a href="qml-qtqml-models-delegatemodel.html#modelIndex-method">modelIndex</a> when a <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> subclass is used as the model. Also, <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> is used together with <a href="qml-package.html">Package</a> to provide delegates to multiple views, and with <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> to sort and filter delegate items.</p>
<p>The example below illustrates using a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> with a ListView.</p>
<pre class="qml">
import QtQuick 2.0
import QtQml.Models 2.2
<span class="type">Rectangle</span> {
<span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="type"><a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a></span> {
<span class="name">id</span>: <span class="name">visualModel</span>
<span class="name">model</span>: <span class="name">ListModel</span> {
<span class="type"><a href="qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">name</span>: <span class="string">"Apple"</span> }
<span class="type"><a href="qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">name</span>: <span class="string">"Orange"</span> }
}
<span class="name">delegate</span>: <span class="name">Rectangle</span> {
<span class="name">height</span>: <span class="number">25</span>
<span class="name">width</span>: <span class="number">100</span>
<span class="type">Text</span> { <span class="name">text</span>: <span class="string">"Name: "</span> <span class="operator">+</span> <span class="name">name</span>}
}
}
<span class="type">ListView</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">model</span>: <span class="name">visualModel</span>
}
}
</pre>
<p><b>Note: </b>This type is also available as <a href="qml-visualdatamodel.html">VisualDataModel</a> in the <a href="qtqml-index.html">Qt QML</a> module due to compatibility reasons.</p><!-- @@@DelegateModel -->
<h2>Property Documentation</h2>
<!-- $$$count -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="count-prop">
<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><div class="qmldoc"></div></div><!-- @@@count -->
<br/>
<!-- $$$delegate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="delegate-prop">
<td class="tblQmlPropNode"><p>
<a name="delegate-prop"></a><span class="name">delegate</span> : <span class="type"><a href="qml-qtqml-component.html">Component</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The delegate provides a template defining each item instantiated by a view. The index is exposed as an accessible <code>index</code> property. Properties of the model are also available depending upon the type of Data Model.</p>
</div></div><!-- @@@delegate -->
<br/>
<!-- $$$filterOnGroup -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="filterOnGroup-prop">
<td class="tblQmlPropNode"><p>
<a name="filterOnGroup-prop"></a><span class="name">filterOnGroup</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the name of the group used to filter the visual data model.</p>
<p>Only items which belong to this group are visible to a view.</p>
<p>By default this is the <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> group.</p>
</div></div><!-- @@@filterOnGroup -->
<br/>
<!-- $$$groups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="groups-prop">
<td class="tblQmlPropNode"><p>
<a name="groups-prop"></a><span class="name">groups</span> : <span class="type">list</span><<span class="type"><a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a></span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds a delegate model's group definitions.</p>
<p>Groups define a sub-set of the items in a delegate model and can be used to filter a model.</p>
<p>For every group defined in a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> two attached properties are added to each delegate item. The first of the form <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>.in<i>GroupName</i> holds whether the item belongs to the group and the second <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>.<i>groupName</i>Index holds the index of the item in that group.</p>
<p>The following example illustrates using groups to select items in a model.</p>
<pre class="qml">
import QtQuick 2.0
import QtQml.Models 2.2
<span class="type">Rectangle</span> {
<span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="type"><a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a></span> {
<span class="name">id</span>: <span class="name">visualModel</span>
<span class="name">model</span>: <span class="name">ListModel</span> {
<span class="type"><a href="qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">name</span>: <span class="string">"Apple"</span> }
<span class="type"><a href="qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">name</span>: <span class="string">"Orange"</span> }
}
<span class="name">groups</span>: [
<span class="type"><a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a></span> { <span class="name">name</span>: <span class="string">"selected"</span> }
]
<span class="name">delegate</span>: <span class="name">Rectangle</span> {
<span class="name">id</span>: <span class="name">item</span>
<span class="name">height</span>: <span class="number">25</span>
<span class="name">width</span>: <span class="number">200</span>
<span class="type">Text</span> {
<span class="name">text</span>: {
var <span class="name">text</span> = <span class="string">"Name: "</span> <span class="operator">+</span> <span class="name">name</span>
<span class="keyword">if</span> (<span class="name">item</span>.<span class="name">DelegateModel</span>.<span class="name">inSelected</span>)
<span class="name">text</span> <span class="operator">+=</span> <span class="string">" ("</span> <span class="operator">+</span> <span class="name">item</span>.<span class="name">DelegateModel</span>.<span class="name">selectedIndex</span> <span class="operator">+</span> <span class="string">")"</span>
<span class="keyword">return</span> <span class="name">text</span>;
}
}
<span class="type">MouseArea</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">item</span>.<span class="name">DelegateModel</span>.<span class="name">inSelected</span> <span class="operator">=</span> !<span class="name">item</span>.<span class="name">DelegateModel</span>.<span class="name">inSelected</span>
}
}
}
<span class="type">ListView</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">model</span>: <span class="name">visualModel</span>
}
}
</pre>
</div></div><!-- @@@groups -->
<br/>
<!-- $$$items -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="items-prop">
<td class="tblQmlPropNode"><p>
<a name="items-prop"></a><span class="name">items</span> : <span class="type"><a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds visual data model's default group to which all new items are added.</p>
</div></div><!-- @@@items -->
<br/>
<!-- $$$model -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="model-prop">
<td class="tblQmlPropNode"><p>
<a name="model-prop"></a><span class="name">model</span> : <span class="type"><a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">model</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the model providing data for the <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>.</p>
<p>The model provides a set of data that is used to create the items for a view. For large or dynamic datasets the model is usually provided by a C++ model object. The C++ model object must be a <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> subclass or a simple list.</p>
<p>Models can also be created directly in QML, using a <a href="qml-qtqml-models-listmodel.html">ListModel</a> or XmlListModel.</p>
<p><b>See also </b>Data Models.</p>
</div></div><!-- @@@model -->
<br/>
<!-- $$$parts -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="parts-prop">
<td class="tblQmlPropNode"><p>
<a name="parts-prop"></a><span class="name">parts</span> : <span class="type">object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <i>parts</i> property selects a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> which creates delegates from the part named. This is used in conjunction with the <a href="qml-package.html">Package</a> type.</p>
<p>For example, the code below selects a model which creates delegates named <i>list</i> from a <a href="qml-package.html">Package</a>:</p>
<pre class="cpp">
DelegateModel {
id: visualModel
delegate: Package {
Item { Package<span class="operator">.</span>name: <span class="string">"list"</span> }
}
model: myModel
}
ListView {
width: <span class="number">200</span>; height:<span class="number">200</span>
model: visualModel<span class="operator">.</span>parts<span class="operator">.</span>list
}
</pre>
<p><b>See also </b><a href="qml-package.html">Package</a>.</p>
</div></div><!-- @@@parts -->
<br/>
<!-- $$$persistedItems -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="persistedItems-prop">
<td class="tblQmlPropNode"><p>
<a name="persistedItems-prop"></a><span class="name">persistedItems</span> : <span class="type"><a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds visual data model's persisted items group.</p>
<p>Items in this group are not destroyed when released by a view, instead they are persisted until removed from the group.</p>
<p>An item can be removed from the persistedItems group by setting the <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>.<a href="qml-qtqml-models-delegatemodel.html#inPersistedItems-attached-prop">inPersistedItems</a> property to false. If the item is not referenced by a view at that time it will be destroyed. Adding an item to this group will not create a new instance.</p>
<p>Items returned by the <a href="qml-qtqml-models-delegatemodelgroup.html#create-method">QtQml.Models::DelegateModelGroup::create()</a> function are automatically added to this group.</p>
</div></div><!-- @@@persistedItems -->
<br/>
<!-- $$$rootIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rootIndex-prop">
<td class="tblQmlPropNode"><p>
<a name="rootIndex-prop"></a><span class="name">rootIndex</span> : <span class="type">QModelIndex</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p><a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> provides a hierarchical tree of data, whereas QML only operates on list data. <code>rootIndex</code> allows the children of any node in a <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> to be provided by this model.</p>
<p>This property only affects models of type <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> that are hierarchical (e.g, a tree model).</p>
<p>For example, here is a simple interactive file system browser. When a directory name is clicked, the view's <code>rootIndex</code> is set to the <a href="../qtcore/qmodelindex.html">QModelIndex</a> node of the clicked directory, thus updating the view to show the new directory's contents.</p>
<p><code>main.cpp</code>:</p>
<pre class="cpp">
<span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span><span class="operator">*</span> argv)
{
<span class="type">QApplication</span> app(argc<span class="operator">,</span> argv);
<span class="type">QQuickView</span> view;
<span class="type">QDirModel</span> model;
view<span class="operator">.</span>rootContext()<span class="operator">-</span><span class="operator">></span>setContextProperty(<span class="string">"dirModel"</span><span class="operator">,</span> <span class="operator">&</span>model);
view<span class="operator">.</span>setSource(<span class="type">QUrl</span><span class="operator">::</span>fromLocalFile(<span class="string">"view.qml"</span>));
view<span class="operator">.</span>show();
<span class="keyword">return</span> app<span class="operator">.</span>exec();
}
</pre>
<p><code>view.qml</code>:</p>
<pre class="qml">
import QtQuick 2.0
import QtQml.Models 2.2
<span class="type">ListView</span> {
<span class="name">id</span>: <span class="name">view</span>
<span class="name">width</span>: <span class="number">300</span>
<span class="name">height</span>: <span class="number">400</span>
<span class="name">model</span>: <span class="name">DelegateModel</span> {
<span class="name">model</span>: <span class="name">dirModel</span>
<span class="name">delegate</span>: <span class="name">Rectangle</span> {
<span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>: <span class="number">25</span>
<span class="type">Text</span> { <span class="name">text</span>: <span class="name">filePath</span> }
<span class="type">MouseArea</span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: {
<span class="keyword">if</span> (<span class="name">model</span>.<span class="name">hasModelChildren</span>)
<span class="name">view</span>.<span class="name">model</span>.<span class="name">rootIndex</span> <span class="operator">=</span> <span class="name">view</span>.<span class="name">model</span>.<span class="name">modelIndex</span>(<span class="name">index</span>)
}
}
}
}
}
</pre>
<p>If the <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">model</a> is a <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> subclass, the delegate can also reference a <code>hasModelChildren</code> property (optionally qualified by a <i>model</i>. prefix) that indicates whether the delegate's model item has any child nodes.</p>
<p><b>See also </b><a href="qml-qtqml-models-delegatemodel.html#modelIndex-method">modelIndex()</a> and <a href="qml-qtqml-models-delegatemodel.html#parentModelIndex-method">parentModelIndex()</a>.</p>
</div></div><!-- @@@rootIndex -->
<br/>
<h2>Attached Property Documentation</h2>
<!-- $$$groups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="groups-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="groups-attached-prop"></a><span class="name">DelegateModel.groups</span> : <span class="type">stringlist</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the name of DelegateModelGroups the item belongs to.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@groups -->
<br/>
<!-- $$$inItems -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="inItems-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="inItems-attached-prop"></a><span class="name">DelegateModel.inItems</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds whether the item belongs to the default <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a>.</p>
<p>Changing this property will add or remove the item from the items group.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@inItems -->
<br/>
<!-- $$$inPersistedItems -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="inPersistedItems-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="inPersistedItems-attached-prop"></a><span class="name">DelegateModel.inPersistedItems</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds whether the item belongs to the <a href="qml-qtqml-models-delegatemodel.html#persistedItems-prop">persistedItems</a> <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a>.</p>
<p>Changing this property will add or remove the item from the items group. Change with caution as removing an item from the <a href="qml-qtqml-models-delegatemodel.html#persistedItems-prop">persistedItems</a> group will destroy the current instance if it is not referenced by a model.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@inPersistedItems -->
<br/>
<!-- $$$isUnresolved -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isUnresolved-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="isUnresolved-attached-prop"></a><span class="name">DelegateModel.isUnresolved</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds whether the visual item is bound to a data model index. Returns true if the item is not bound to the model, and false if it is.</p>
<p>An unresolved item can be bound to the data model using the <a href="qml-qtqml-models-delegatemodelgroup.html#resolve-method">DelegateModelGroup::resolve()</a> function.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@isUnresolved -->
<br/>
<!-- $$$itemsIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="itemsIndex-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="itemsIndex-attached-prop"></a><span class="name">DelegateModel.itemsIndex</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the index of the item in the default <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a>.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@itemsIndex -->
<br/>
<!-- $$$model -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="model-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="model-attached-prop"></a><span class="name">DelegateModel.model</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the visual data model this delegate instance belongs to.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@model -->
<br/>
<!-- $$$persistedItemsIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="persistedItemsIndex-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="persistedItemsIndex-attached-prop"></a><span class="name">DelegateModel.persistedItemsIndex</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the index of the item in the <a href="qml-qtqml-models-delegatemodel.html#persistedItems-prop">persistedItems</a> <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a>.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@persistedItemsIndex -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$modelIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="modelIndex-method">
<td class="tblQmlFuncNode"><p>
<a name="modelIndex-method"></a><span class="type">QModelIndex</span> <span class="name">modelIndex</span>(<span class="type">int</span> <i>index</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p><a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> provides a hierarchical tree of data, whereas QML only operates on list data. This function assists in using tree models in QML.</p>
<p>Returns a <a href="../qtcore/qmodelindex.html">QModelIndex</a> for the specified index. This value can be assigned to <a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a>.</p>
<p><b>See also </b><a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a>.</p>
</div></div><!-- @@@modelIndex -->
<br/>
<!-- $$$parentModelIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="parentModelIndex-method">
<td class="tblQmlFuncNode"><p>
<a name="parentModelIndex-method"></a><span class="type">QModelIndex</span> <span class="name">parentModelIndex</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p><a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> provides a hierarchical tree of data, whereas QML only operates on list data. This function assists in using tree models in QML.</p>
<p>Returns a <a href="../qtcore/qmodelindex.html">QModelIndex</a> for the parent of the current <a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a>. This value can be assigned to <a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a>.</p>
<p><b>See also </b><a href="qml-qtqml-models-delegatemodel.html#rootIndex-prop">rootIndex</a>.</p>
</div></div><!-- @@@parentModelIndex -->
<br/>
</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>
|