Sophie

Sophie

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

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" />
<!-- basictypes.qdoc -->
  <title>list QML Basic 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 >list QML Basic 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="#using-the-list-type">Using the list Type</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">list QML Basic Type</h1>
<span class="subtitle"></span>
<!-- $$$list-description -->
<div class="descr"> <a name="details"></a>
<p>a list of QML objects.</p>
<p>The <code>list</code> type refers to a list of QML objects.</p>
<p>A list value can be accessed in a similar way to a JavaScript array:</p>
<ul>
<li>Values are assigned using the <code>[]</code> square bracket syntax with comma-separated values</li>
<li>The <code>length</code> property provides the number of items in the list</li>
<li>Values in the list are accessed using the <code>[index]</code> syntax</li>
</ul>
<p>Values can be dynamically added to the list by using the <code>push</code> method, as if it were a JavaScript Array</p>
<p>A <code>list</code> can only store QML objects, and cannot contain any <a href="qtqml-typesystem-basictypes.html">basic type</a> values. (To store basic types within a list, use the <a href="qml-var.html">var</a> type instead.)</p>
<p>When integrating with C++, note that any <a href="qqmllistproperty.html">QQmlListProperty</a> value <a href="qtqml-cppintegration-data.html">passed into QML from C++</a> is automatically converted into a <code>list</code> value, and vice-versa.</p>
<a name="using-the-list-type"></a>
<h2 id="using-the-list-type">Using the list Type</h2>
<p>For example, the Item type has a states list-type property that can be assigned to and used as follows:</p>
<pre class="qml">



</pre>
<p>The defined <a href="qml-qtqml-statemachine-state.html">State</a> objects will be added to the <code>states</code> list in the order in which they are defined.</p>
<p>If the list only contains one object, the square brackets may be omitted:</p>
<pre class="qml">



</pre>
<p>Note that objects cannot be individually added to or removed from the list once created; to modify the contents of a list, it must be reassigned to a new list.</p>
<p><b>Note: </b>The <code>list</code> type is not recommended as a type for custom properties. The <code>var</code> type should be used instead for this purpose as lists stored by the <code>var</code> type can be manipulated with greater flexibility from within QML.</p><p>This basic type is provided by the QML language.</p>
</div>
<p><b>See also </b><a href="qtqml-typesystem-basictypes.html">QML Basic Types</a>.</p>
<!-- @@@list -->
        </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>