Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 6e2327ca1c896c6d674ae53117299f21 > files > 94

qtdeclarative5-doc-5.12.6-1.mga7.noarch.rpm

<?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.12.6</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.12</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"><a href="qtqml-index.html">Qt 5.12.6 Reference Documentation</a></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.12</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&lt;DelegateModelGroup&gt;</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> : model</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

  Rectangle {
      width: 200; height: 100

      DelegateModel {
          id: visualModel
          model: ListModel {
              ListElement { name: "Apple" }
              ListElement { name: "Orange" }
          }
          delegate: Rectangle {
              height: 25
              width: 100
              Text { text: "Name: " + name}
          }
      }

      ListView {
          anchors.fill: parent
          model: visualModel
      }
  }

</pre>
<!-- @@@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"><a href="qml-int.html">int</a></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"><a href="qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds name of the group that is used to filter the delegate model.</p>
<p>Only items that 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"><a href="qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a></span>&gt;</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

  Rectangle {
      width: 200; height: 100

      DelegateModel {
          id: visualModel
          model: ListModel {
              ListElement { name: "Apple" }
              ListElement { name: "Orange" }
          }

          groups: [
              DelegateModelGroup { name: "selected" }
          ]

          delegate: Rectangle {
              id: item
              height: 25
              width: 200
              Text {
                  text: {
                      var text = "Name: " + name
                      if (item.DelegateModel.inSelected)
                          text += " (" + item.DelegateModel.selectedIndex + ")"
                      return text;
                  }
              }
              MouseArea {
                  anchors.fill: parent
                  onClicked: item.DelegateModel.inSelected = !item.DelegateModel.inSelected
              }
          }
      }

      ListView {
          anchors.fill: parent
          model: visualModel
      }
  }

</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 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">model</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">&quot;list&quot;</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 delegate 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"><a href="qml-int.html">int</a></span> main(<span class="type"><a href="qml-int.html">int</a></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">&gt;</span>setContextProperty(<span class="string">&quot;dirModel&quot;</span><span class="operator">,</span> <span class="operator">&amp;</span>model);

      view<span class="operator">.</span>setSource(<span class="type">QUrl</span><span class="operator">::</span>fromLocalFile(<span class="string">&quot;view.qml&quot;</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

  ListView {
      id: view
      width: 300
      height: 400

      model: DelegateModel {
          model: dirModel

          delegate: Rectangle {
              width: 200; height: 25
              Text { text: filePath }

              MouseArea {
                  anchors.fill: parent
                  onClicked: {
                      if (model.hasModelChildren)
                          view.model.rootIndex = view.model.modelIndex(index)
                  }
              }
          }
      }
  }

</pre>
<p>If the <a href="qml-qtqml-models-delegatemodel.html#model-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"><a href="qml-int.html">int</a></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"><a href="qml-int.html">int</a></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"><a href="qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property indicates 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"><a href="qml-int.html">int</a></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">model</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the 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"><a href="qml-int.html">int</a></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"><a href="qml-int.html">int</a></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">&copy;</acronym> 2019 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>