Sophie

Sophie

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

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>DelegateModelGroup 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 >DelegateModelGroup 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="#signals">Signals</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">DelegateModelGroup QML Type</h1>
<span class="subtitle"></span>
<!-- $$$DelegateModelGroup-brief -->
<p>Encapsulates a filtered set of visual data items. <a href="#details">More...</a></p>
<!-- @@@DelegateModelGroup -->
<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-delegatemodelgroup-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-delegatemodelgroup.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#includeByDefault-prop">includeByDefault</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#name-prop">name</a></b></b> : string</li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#changed-signal">changed</a></b></b>(array <i>removed</i>,  array <i>inserted</i>)</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#addGroups-method">addGroups</a></b></b>(int <i>index</i>,  int <i>count</i>,  stringlist <i>groups</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#create-method">create</a></b></b>(int <i>index</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#create-method-1">create</a></b></b>(int <i>index</i>,  jsdict <i>data</i>,  array groups = <i>undefined</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#create-method-2">create</a></b></b>(jsdict <i>data</i>,  array groups = <i>undefined</i>)</li>
<li class="fn">object <b><b><a href="qml-qtqml-models-delegatemodelgroup.html#get-method">get</a></b></b>(int <i>index</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#insert-method">insert</a></b></b>(int <i>index</i>,  jsdict <i>data</i>,  array groups = <i>undefined</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#insert-method-1">insert</a></b></b>(jsdict <i>data</i>,  var groups = <i>undefined</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#move-method">move</a></b></b>(var <i>from</i>,  var <i>to</i>,  int <i>count</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#remove-method">remove</a></b></b>(int <i>index</i>,  int <i>count</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#removeGroups-method">removeGroups</a></b></b>(int <i>index</i>,  int <i>count</i>,  stringlist <i>groups</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#resolve-method">resolve</a></b></b>(int <i>from</i>,  int <i>to</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#setGroups-method">setGroups</a></b></b>(int <i>index</i>,  int <i>count</i>,  stringlist <i>groups</i>)</li>
<li class="fn"><b><b><a href="qml-qtqml-models-delegatemodelgroup.html#setGroups-method-1">setGroups</a></b></b>(int <i>index</i>,  int <i>count</i>,  stringlist <i>groups</i>)</li>
</ul>
<!-- $$$DelegateModelGroup-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> type provides a means to address the model data of a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a>'s delegate items, as well as sort and filter these delegate items.</p>
<p>The initial set of instantiable delegate items in a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> is represented by its <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> group, which normally directly reflects the contents of the model assigned to <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a>. This set can be changed to the contents of any other member of <a href="qml-qtqml-models-delegatemodel.html#groups-attached-prop">DelegateModel::groups</a> by assigning the <a href="qml-qtqml-models-delegatemodelgroup.html#name-prop">name</a> of that <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> to the <a href="qml-qtqml-models-delegatemodel.html#filterOnGroup-prop">DelegateModel::filterOnGroup</a> property.</p>
<p>The data of an item in a <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> can be accessed using the <a href="qml-qtqml-models-delegatemodelgroup.html#get-method">get()</a> function, which returns information about group membership and indexes as well as model data. In combination with the <a href="qml-qtqml-models-delegatemodelgroup.html#move-method">move()</a> function this can be used to implement view sorting, with <a href="qml-qtqml-models-delegatemodelgroup.html#remove-method">remove()</a> to filter items out of a view, or with <a href="qml-qtqml-models-delegatemodelgroup.html#setGroups-method">setGroups()</a> and <a href="qml-package.html">Package</a> delegates to categorize items into different views. Different groups can only be sorted independently if they are disjunct. Moving an item in one group will also move it in all other groups it is a part of.</p>
<p>Data from models can be supplemented by inserting data directly into a <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> with the <a href="qml-qtqml-models-delegatemodelgroup.html#insert-method">insert()</a> function. This can be used to introduce mock items into a view, or placeholder items that are later <a href="qml-qtqml-models-delegatemodelgroup.html#resolve-method">resolved</a> to real model data when it becomes available.</p>
<p>Delegate items can also be instantiated directly from a <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> using the <a href="qml-qtqml-models-delegatemodelgroup.html#create-method">create()</a> function, making it possible to use <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> without an accompanying view type or to cherry-pick specific items that should be instantiated irregardless of whether they're currently within a view's visible area.</p>
<p><b>See also </b>QML Dynamic View Ordering Tutorial.</p>
<!-- @@@DelegateModelGroup -->
<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"><p>This property holds the number of items in the group.</p>
</div></div><!-- @@@count -->
<br/>
<!-- $$$includeByDefault -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="includeByDefault-prop">
<td class="tblQmlPropNode"><p>
<a name="includeByDefault-prop"></a><span class="name">includeByDefault</span> : <span class="type"><a href="qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether new items are assigned to this group by default.</p>
</div></div><!-- @@@includeByDefault -->
<br/>
<!-- $$$name -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="name-prop">
<td class="tblQmlPropNode"><p>
<a name="name-prop"></a><span class="name">name</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 the name of the group.</p>
<p>Each group in a model must have a unique name starting with a lower case letter.</p>
</div></div><!-- @@@name -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$changed -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="changed-signal">
<td class="tblQmlFuncNode"><p>
<a name="changed-signal"></a><span class="name">changed</span>(<span class="type">array</span> <i>removed</i>,  <span class="type">array</span> <i>inserted</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when items have been removed from or inserted into the group.</p>
<p>Each object in the <i>removed</i> and <i>inserted</i> arrays has two values; the <i>index</i> of the first item inserted or removed and a <i>count</i> of the number of consecutive items inserted or removed.</p>
<p>Each index is adjusted for previous changes with all removed items preceding any inserted items.</p>
<p>The corresponding handler is <code>onChanged</code>.</p>
</div></div><!-- @@@changed -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="create-method"></a><span class="name">create</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="create-method-1"></a><span class="name">create</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type">jsdict</span> <i>data</i>,  <span class="type">array</span> <span class="type">groups</span> = <i>undefined</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="create-method-2"></a><span class="name">create</span>(<span class="type">jsdict</span> <i>data</i>,  <span class="type">array</span> <span class="type">groups</span> = <i>undefined</i>)</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p>Returns a reference to the instantiated item at <i>index</i> in the group.</p>
<p>If a <i>data</i> object is provided it will be <a href="qml-qtqml-models-delegatemodelgroup.html#insert-method">inserted</a> at <i>index</i> and an item referencing this new entry will be returned. The optional <i>groups</i> parameter identifies the groups the new entry should belong to, if unspecified this is equal to the group <a href="qml-qtqml-models-delegatemodelgroup.html#create-method">create()</a> was called on.</p>
<p>All items returned by create are added to the <a href="qml-qtqml-models-delegatemodel.html#persistedItems-prop">persistedItems</a> group. Items in this group remain instantiated when not referenced by any view.</p>
</div></div><!-- @@@ -->
<br/>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="insert-method"></a><span class="name">insert</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type">jsdict</span> <i>data</i>,  <span class="type">array</span> <span class="type">groups</span> = <i>undefined</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="insert-method-1"></a><span class="name">insert</span>(<span class="type">jsdict</span> <i>data</i>,  <span class="type"><a href="qml-var.html">var</a></span> <span class="type">groups</span> = <i>undefined</i>)</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p>Creates a new entry at <i>index</i> in a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> with the values from <i>data</i> that correspond to roles in the model assigned to <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a>.</p>
<p>If no index is supplied the data is appended to the model.</p>
<p>The optional <i>groups</i> parameter identifies the groups the new entry should belong to, if unspecified this is equal to the group insert was called on.</p>
<p>Data inserted into a <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> can later be merged with an existing entry in <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a> using the <a href="qml-qtqml-models-delegatemodelgroup.html#resolve-method">resolve()</a> function. This can be used to create placeholder items that are later replaced by actual data.</p>
</div></div><!-- @@@ -->
<br/>
<!-- $$$addGroups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="addGroups-method">
<td class="tblQmlFuncNode"><p>
<a name="addGroups-method"></a><span class="name">addGroups</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>,  <span class="type">stringlist</span> <i>groups</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds <i>count</i> items starting at <i>index</i> to <i>groups</i>.</p>
</div></div><!-- @@@addGroups -->
<br/>
<!-- $$$get -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="get-method">
<td class="tblQmlFuncNode"><p>
<a name="get-method"></a><span class="type">object</span> <span class="name">get</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>Returns a javascript object describing the item at <i>index</i> in the group.</p>
<p>The returned object contains the same information that is available to a delegate from the <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> attached as well as the model for that item. It has the properties:</p>
<ul>
<li><b>model</b> The model data of the item. This is the same as the model context property in a delegate</li>
<li><b>groups</b> A list the of names of groups the item is a member of. This property can be written to change the item's membership.</li>
<li><b>inItems</b> Whether the item belongs to the <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> group. Writing to this property will add or remove the item from the group.</li>
<li><b>itemsIndex</b> The index of the item within the <a href="qml-qtqml-models-delegatemodel.html#items-prop">items</a> group.</li>
<li><b>in&lt;GroupName&gt;</b> Whether the item belongs to the dynamic group <i>groupName</i>. Writing to this property will add or remove the item from the group.</li>
<li><b>&lt;groupName&gt;Index</b> The index of the item within the dynamic group <i>groupName</i>.</li>
<li><b>isUnresolved</b> Whether the item is bound to an index in the model assigned to <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a>. Returns true if the item is not bound to the model, and false if it is.</li>
</ul>
</div></div><!-- @@@get -->
<br/>
<!-- $$$move -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="move-method">
<td class="tblQmlFuncNode"><p>
<a name="move-method"></a><span class="name">move</span>(<span class="type"><a href="qml-var.html">var</a></span> <i>from</i>,  <span class="type"><a href="qml-var.html">var</a></span> <i>to</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Moves <i>count</i> at <i>from</i> in a group <i>to</i> a new position.</p>
<p><b>Note: </b>The <a href="qml-qtqml-models-delegatemodel.html">DelegateModel</a> acts as a proxy model: it holds the delegates in a different order than the <a href="qml-qtqml-models-delegatemodel.html#model-prop">underlying model</a> has them. Any subsequent changes to the underlying model will not undo whatever reordering you have done via this function.</p></div></div><!-- @@@move -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="remove-method">
<td class="tblQmlFuncNode"><p>
<a name="remove-method"></a><span class="name">remove</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes <i>count</i> items starting at <i>index</i> from the group.</p>
</div></div><!-- @@@remove -->
<br/>
<!-- $$$removeGroups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="removeGroups-method">
<td class="tblQmlFuncNode"><p>
<a name="removeGroups-method"></a><span class="name">removeGroups</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>,  <span class="type">stringlist</span> <i>groups</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes <i>count</i> items starting at <i>index</i> from <i>groups</i>.</p>
</div></div><!-- @@@removeGroups -->
<br/>
<!-- $$$resolve -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="resolve-method">
<td class="tblQmlFuncNode"><p>
<a name="resolve-method"></a><span class="name">resolve</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>from</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>to</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Binds an unresolved item at <i>from</i> to an item in <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a> at index <i>to</i>.</p>
<p>Unresolved items are entries whose data has been <a href="qml-qtqml-models-delegatemodelgroup.html#insert-method">inserted</a> into a <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> instead of being derived from a <a href="qml-qtqml-models-delegatemodel.html#model-attached-prop">DelegateModel::model</a> index. Resolving an item will replace the item at the target index with the unresolved item. A resolved an item will reflect the data of the source model at its bound index and will move when that index moves like any other item.</p>
<p>If a new item is replaced in the <a href="qml-qtqml-models-delegatemodelgroup.html">DelegateModelGroup</a> onChanged() handler its insertion and replacement will be communicated to views as an atomic operation, creating the appearance that the model contents have not changed, or if the unresolved and model item are not adjacent that the previously unresolved item has simply moved.</p>
</div></div><!-- @@@resolve -->
<br/>
<!-- $$$setGroups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="setGroups-method">
<td class="tblQmlFuncNode"><p>
<a name="setGroups-method"></a><span class="name">setGroups</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>,  <span class="type">stringlist</span> <i>groups</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the <i>groups</i> <i>count</i> items starting at <i>index</i> belong to.</p>
</div></div><!-- @@@setGroups -->
<br/>
<!-- $$$setGroups -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="setGroups-method-1">
<td class="tblQmlFuncNode"><p>
<a name="setGroups-method-1"></a><span class="name">setGroups</span>(<span class="type"><a href="qml-int.html">int</a></span> <i>index</i>,  <span class="type"><a href="qml-int.html">int</a></span> <i>count</i>,  <span class="type">stringlist</span> <i>groups</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the <i>groups</i> <i>count</i> items starting at <i>index</i> belong to.</p>
</div></div><!-- @@@setGroups -->
<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>