<?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.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="#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 QAbstractItemModel 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 QAbstractItemModel 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>QAbstractItemModel provides a hierarchical tree of data, whereas QML only operates on list data. <code>rootIndex</code> allows the children of any node in a QAbstractItemModel to be provided by this model.</p> <p>This property only affects models of type QAbstractItemModel 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 QModelIndex 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 QAbstractItemModel 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>QAbstractItemModel 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 QModelIndex 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>QAbstractItemModel 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 QModelIndex 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>