Sophie

Sophie

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

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" />
<!-- qqmlitemmodels.qdoc -->
  <title>QModelIndex and related Classes in QML | 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 >QModelIndex and related Classes in QML</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="#qmodelindex-and-qpersistentmodelindex-types">QModelIndex and QPersistentModelIndex Types</a></li>
<li class="level1"><a href="#qmodelindexlist-type">QModelIndexList Type</a></li>
<li class="level1"><a href="#qitemselectionrange-type">QItemSelectionRange Type</a></li>
<li class="level1"><a href="#qitemselection-type">QItemSelection Type</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QModelIndex and related Classes in QML</h1>
<span class="subtitle"></span>
<!-- $$$qmodelindex-and-related-classes-in-qml.html-description -->
<div class="descr"> <a name="details"></a>
<p>Since Qt 5.5, QModelIndex and QPersistentModelIndex are exposed in QML as value-based types. Also exposed in a similar fashion are QModelIndexList, QItemSelectionRange and QItemSelection. All objects from these types can be passed back and forth between QML and C++ as <code>var</code> properties or plain JavaScript variables.</p>
<p>Below you will find an overview of the API exposed to QML for these classes. For more information, refer to their C++ documentation.</p>
<p><b>Note: </b>Since all these types are exposed as gadgets, there are no property change notification signals emitted. Therefore binding to their properties may not give the expected results. This is especially true for QPersistentModelIndex.</p><a name="qmodelindex-and-qpersistentmodelindex-types"></a>
<h2 id="qmodelindex-and-qpersistentmodelindex-types">QModelIndex and QPersistentModelIndex Types</h2>
<ul>
<li><b>row</b> : int</li>
<li><b>column</b> : int</li>
<li><b>parent</b> : QModelIndex</li>
<li><b>valid</b> : bool</li>
<li><b>model</b> : QAbstractItemModel</li>
<li><b>internalId</b> : quint64</li>
</ul>
<p>All these properties are read-only, as are their C++ counterparts.</p>
<p><b>Note: </b>The usual caveats apply to QModelIndex in QML. If the underlying model changes or gets deleted, it may become dangerous to access its properties. Therefore, you should not store any QModelIndex objects. You can, however, store QPersistentModelIndexe objects in a safe way.</p><a name="qmodelindexlist-type"></a>
<h2 id="qmodelindexlist-type">QModelIndexList Type</h2>
<p>QModelIndexList is exposed in QML as a JavaScript array. Conversions are automatically made from and to C++. In fact, any JavaScript array can be converted back to QModelIndexList, with non-QModelIndex objects replaced by invalid QModelIndexes.</p>
<p><b>Note: </b>QModelIndex to QPersistentModelIndex conversion happens when accessing the array elements because any QModelIndexList property retains reference semantics when exposed this way.</p><a name="qitemselectionrange-type"></a>
<h2 id="qitemselectionrange-type">QItemSelectionRange Type</h2>
<ul>
<li><b>top</b> : int</li>
<li><b>left</b> : int</li>
<li><b>bottom</b> : int</li>
<li><b>right</b> : int</li>
<li><b>width</b> : int</li>
<li><b>height</b> : int</li>
<li><b>topLeft</b> : QPersistentModelIndex</li>
<li><b>bottomRight</b> : QPersistentModelIndex</li>
<li><b>parent</b> : QModelIndex</li>
<li><b>valid</b> : bool</li>
<li><b>empty</b> : bool</li>
<li><b>model</b> : QAbstractItemModel</li>
</ul>
<p>All these properties are read-only, as are their C++ counterparts. In addition, we also expose the following functions:</p>
<ul>
<li>bool <b>contains</b>(QModelIndex <i>index</i>)</li>
<li>bool <b>contains</b>(int <i>row</i>, int <i>column</i>, QModelIndex <i>parentIndex</i>)</li>
<li>bool <b>intersects</b>(QItemSelectionRange <i>other</i>)</li>
<li>QItemSelectionRange <b>intersected</b>(QItemSelectionRange <i>other</i>)</li>
</ul>
<a name="qitemselection-type"></a>
<h2 id="qitemselection-type">QItemSelection Type</h2>
<p>Similarly to QModelIndexList, QItemSelection is exposed in QML as a JavaScript array of QItemSelectionRange objects. Conversions are automatically made from and to C++. In fact, any JavaScript array can be converted back to QItemSelection, with non-QItemSelectionRange objects replaced by empty QItemSelectionRanges.</p>
</div>
<p><b>See also </b><a href="qml-qtqml-models-itemselectionmodel.html">ItemSelectionModel</a>.</p>
<!-- @@@qmodelindex-and-related-classes-in-qml.html -->
        </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>