Sophie

Sophie

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

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" />
<!-- qqmllist.cpp -->
  <title>QQmlListReference Class | 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-module.html">C++ Classes</a></td><td >QQmlListReference</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="#public-functions">Public Functions</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">QQmlListReference Class</h1>
<!-- $$$QQmlListReference-brief -->
<p>The <a href="qqmllistreference.html">QQmlListReference</a> class allows the manipulation of <a href="qqmllistproperty.html">QQmlListProperty</a> properties. <a href="#details">More...</a></p>
<!-- @@@QQmlListReference -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QQmlListReference&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += qml</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 5.0</td></tr></table></div><ul>
<li><a href="qqmllistreference-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#QQmlListReference">QQmlListReference</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#QQmlListReference-1">QQmlListReference</a></b>(QObject *<i>object</i>, const char *<i>property</i>, QQmlEngine *<i>engine</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#append">append</a></b>(QObject *<i>object</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QObject *</td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#at">at</a></b>(int <i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#canAppend">canAppend</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#canAt">canAt</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#canClear">canClear</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#canCount">canCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#clear">clear</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#count">count</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#isManipulable">isManipulable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#isReadable">isReadable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject *</td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#listElementType">listElementType</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QObject *</td><td class="memItemRight bottomAlign"><b><a href="qqmllistreference.html#object">object</a></b>() const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QQmlListReference-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qqmllistreference.html">QQmlListReference</a> class allows the manipulation of <a href="qqmllistproperty.html">QQmlListProperty</a> properties.</p>
<p><a href="qqmllistreference.html">QQmlListReference</a> allows C++ programs to read from, and assign values to a QML list property in a simple and type-safe way. A <a href="qqmllistreference.html">QQmlListReference</a> can be created by passing an object and property name or through a <a href="qqmlproperty.html">QQmlProperty</a> instance. These two are equivalent:</p>
<pre class="cpp">

  <span class="type"><a href="qqmllistreference.html#QQmlListReference">QQmlListReference</a></span> ref1(object<span class="operator">,</span> <span class="string">&quot;children&quot;</span>);

  <span class="type"><a href="qqmlproperty.html">QQmlProperty</a></span> ref2(object<span class="operator">,</span> <span class="string">&quot;children&quot;</span>);
  <span class="type"><a href="qqmllistreference.html#QQmlListReference">QQmlListReference</a></span> ref2 <span class="operator">=</span> qvariant_cast<span class="operator">&lt;</span><span class="type"><a href="qqmllistreference.html#QQmlListReference">QQmlListReference</a></span><span class="operator">&gt;</span>(ref2<span class="operator">.</span>read());

</pre>
<p>Not all QML list properties support all operations. A set of methods, <a href="qqmllistreference.html#canAppend">canAppend</a>(), <a href="qqmllistreference.html#canAt">canAt</a>(), <a href="qqmllistreference.html#canClear">canClear</a>() and <a href="qqmllistreference.html#canCount">canCount</a>() allow programs to query whether an operation is supported on a given property.</p>
<p>QML list properties are type-safe. Only QObject's that derive from the correct base class can be assigned to the list. The <a href="qqmllistreference.html#listElementType">listElementType</a>() method can be used to query the QMetaObject of the QObject type supported. Attempting to add objects of the incorrect type to a list property will fail.</p>
<p>Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure that it does not request an out of range element using the <a href="qqmllistreference.html#count">count</a>() method before calling <a href="qqmllistreference.html#at">at</a>().</p>
</div>
<!-- @@@QQmlListReference -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QQmlListReference[overload1]$$$QQmlListReference -->
<h3 class="fn" id="QQmlListReference"><a name="QQmlListReference"></a>QQmlListReference::<span class="name">QQmlListReference</span>()</h3>
<p>Constructs an invalid instance.</p>
<!-- @@@QQmlListReference -->
<!-- $$$QQmlListReference$$$QQmlListReferenceQObject*constchar*QQmlEngine* -->
<h3 class="fn" id="QQmlListReference-1"><a name="QQmlListReference-1"></a>QQmlListReference::<span class="name">QQmlListReference</span>(<span class="type">QObject</span> *<i>object</i>, const <span class="type">char</span> *<i>property</i>, <span class="type"><a href="qqmlengine.html">QQmlEngine</a></span> *<i>engine</i> = nullptr)</h3>
<p>Constructs a <a href="qqmllistreference.html">QQmlListReference</a> for <i>object</i>'s <i>property</i>. If <i>property</i> is not a list property, an invalid <a href="qqmllistreference.html">QQmlListReference</a> is created. If <i>object</i> is destroyed after the reference is constructed, it will automatically become invalid. That is, it is safe to hold <a href="qqmllistreference.html">QQmlListReference</a> instances even after <i>object</i> is deleted.</p>
<p>Passing <i>engine</i> is required to access some QML created list properties. If in doubt, and an engine is available, pass it.</p>
<!-- @@@QQmlListReference -->
<!-- $$$append[overload1]$$$appendQObject* -->
<h3 class="fn" id="append"><a name="append"></a><span class="type">bool</span> QQmlListReference::<span class="name">append</span>(<span class="type">QObject</span> *<i>object</i>) const</h3>
<p>Appends <i>object</i> to the list. Returns true if the operation succeeded, otherwise false.</p>
<p><b>See also </b><a href="qqmllistreference.html#canAppend">canAppend</a>().</p>
<!-- @@@append -->
<!-- $$$at[overload1]$$$atint -->
<h3 class="fn" id="at"><a name="at"></a><span class="type">QObject</span> *QQmlListReference::<span class="name">at</span>(<span class="type">int</span> <i>index</i>) const</h3>
<p>Returns the list element at <i>index</i>, or 0 if the operation failed.</p>
<p><b>See also </b><a href="qqmllistreference.html#canAt">canAt</a>().</p>
<!-- @@@at -->
<!-- $$$canAppend[overload1]$$$canAppend -->
<h3 class="fn" id="canAppend"><a name="canAppend"></a><span class="type">bool</span> QQmlListReference::<span class="name">canAppend</span>() const</h3>
<p>Returns true if the list property can be appended to, otherwise false. Returns false if the reference is invalid.</p>
<p><b>See also </b><a href="qqmllistreference.html#append">append</a>().</p>
<!-- @@@canAppend -->
<!-- $$$canAt[overload1]$$$canAt -->
<h3 class="fn" id="canAt"><a name="canAt"></a><span class="type">bool</span> QQmlListReference::<span class="name">canAt</span>() const</h3>
<p>Returns true if the list property can queried by index, otherwise false. Returns false if the reference is invalid.</p>
<p><b>See also </b><a href="qqmllistreference.html#at">at</a>().</p>
<!-- @@@canAt -->
<!-- $$$canClear[overload1]$$$canClear -->
<h3 class="fn" id="canClear"><a name="canClear"></a><span class="type">bool</span> QQmlListReference::<span class="name">canClear</span>() const</h3>
<p>Returns true if the list property can be cleared, otherwise false. Returns false if the reference is invalid.</p>
<p><b>See also </b><a href="qqmllistreference.html#clear">clear</a>().</p>
<!-- @@@canClear -->
<!-- $$$canCount[overload1]$$$canCount -->
<h3 class="fn" id="canCount"><a name="canCount"></a><span class="type">bool</span> QQmlListReference::<span class="name">canCount</span>() const</h3>
<p>Returns true if the list property can be queried for its element count, otherwise false. Returns false if the reference is invalid.</p>
<p><b>See also </b><a href="qqmllistreference.html#count">count</a>().</p>
<!-- @@@canCount -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn" id="clear"><a name="clear"></a><span class="type">bool</span> QQmlListReference::<span class="name">clear</span>() const</h3>
<p>Clears the list. Returns true if the operation succeeded, otherwise false.</p>
<p><b>See also </b><a href="qqmllistreference.html#canClear">canClear</a>().</p>
<!-- @@@clear -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn" id="count"><a name="count"></a><span class="type">int</span> QQmlListReference::<span class="name">count</span>() const</h3>
<p>Returns the number of objects in the list, or 0 if the operation failed.</p>
<!-- @@@count -->
<!-- $$$isManipulable[overload1]$$$isManipulable -->
<h3 class="fn" id="isManipulable"><a name="isManipulable"></a><span class="type">bool</span> QQmlListReference::<span class="name">isManipulable</span>() const</h3>
<p>Return true if <a href="qqmllistreference.html#at">at</a>(), <a href="qqmllistreference.html#count">count</a>(), <a href="qqmllistreference.html#append">append</a>() and <a href="qqmllistreference.html#clear">clear</a>() are implemented, so you can manipulate the list.</p>
<p><b>See also </b><a href="qqmllistreference.html#isReadable">isReadable</a>(), <a href="qqmllistreference.html#at">at</a>(), <a href="qqmllistreference.html#count">count</a>(), <a href="qqmllistreference.html#append">append</a>(), and <a href="qqmllistreference.html#clear">clear</a>().</p>
<!-- @@@isManipulable -->
<!-- $$$isReadable[overload1]$$$isReadable -->
<h3 class="fn" id="isReadable"><a name="isReadable"></a><span class="type">bool</span> QQmlListReference::<span class="name">isReadable</span>() const</h3>
<p>Return true if <a href="qqmllistreference.html#at">at</a>() and <a href="qqmllistreference.html#count">count</a>() are implemented, so you can access the elements.</p>
<p><b>See also </b><a href="qqmllistreference.html#isManipulable">isManipulable</a>(), <a href="qqmllistreference.html#at">at</a>(), and <a href="qqmllistreference.html#count">count</a>().</p>
<!-- @@@isReadable -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QQmlListReference::<span class="name">isValid</span>() const</h3>
<p>Returns true if the instance refers to a valid list property, otherwise false.</p>
<!-- @@@isValid -->
<!-- $$$listElementType[overload1]$$$listElementType -->
<h3 class="fn" id="listElementType"><a name="listElementType"></a>const <span class="type">QMetaObject</span> *QQmlListReference::<span class="name">listElementType</span>() const</h3>
<p>Returns the QMetaObject for the elements stored in the list property, or <code>nullptr</code> if the reference is invalid.</p>
<p>The QMetaObject can be used ahead of time to determine whether a given instance can be added to a list.</p>
<!-- @@@listElementType -->
<!-- $$$object[overload1]$$$object -->
<h3 class="fn" id="object"><a name="object"></a><span class="type">QObject</span> *QQmlListReference::<span class="name">object</span>() const</h3>
<p>Returns the list property's object. Returns <code>nullptr</code> if the reference is invalid.</p>
<!-- @@@object -->
</div>
        </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>