/usr/share/qt5/doc/qtquickcontrols2/qml-qtquick-controls2-container.html is in qtquickcontrols2-5-doc-html 5.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickcontainer.cpp -->
<title>Container QML Type | Qt Quick Controls 2 5.7</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
window.onload = function(){document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");};
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.7</td><td ><a href="qtquickcontrols2-index.html">Qt Quick Controls 2</a></td><td ><a href="qtquick-controls2-qmlmodule.html">QML Types</a></td><td >Container QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.7.1 Reference Documentation</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="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#using-containers">Using Containers</a></li>
<li class="level2"><a href="#implementing-containers">Implementing Containers</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Container QML Type</h1>
<span class="subtitle"></span>
<!-- $$$Container-brief -->
<p>A container control base type. <a href="#details">More...</a></p>
<!-- @@@Container -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick.Controls 2.0</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.7</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-controls2-control.html">Control</a></p>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-controls2-swipeview.html">SwipeView</a> and <a href="qml-qtquick-controls2-tabbar.html">TabBar</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-controls2-container-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-qtquick-controls2-container.html#contentChildren-prop">contentChildren</a></b></b> : list<Item></li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-container.html#contentData-prop">contentData</a></b></b> : list<Object></li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-container.html#contentModel-prop">contentModel</a></b></b> : model</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-container.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-container.html#currentIndex-prop">currentIndex</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-container.html#currentItem-prop">currentItem</a></b></b> : Item</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-container.html#addItem-method">addItem</a></b></b>(Item <i>item</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-container.html#insertItem-method">insertItem</a></b></b>(int <i>index</i>, Item <i>item</i>)</li>
<li class="fn">Item <b><b><a href="qml-qtquick-controls2-container.html#itemAt-method">itemAt</a></b></b>(int <i>index</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-container.html#moveItem-method">moveItem</a></b></b>(int <i>from</i>, int <i>to</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-container.html#removeItem-method">removeItem</a></b></b>(int <i>index</i>)</li>
</ul>
<!-- $$$Container-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<p>Container is the base type of container-like user interface controls that allow dynamic insertion and removal of items.</p>
<a name="using-containers"></a>
<h3 >Using Containers</h3>
<p>Typically, items are statically declared as children of Container, but it is also possible to <a href="qml-qtquick-controls2-container.html#addItem-method">add</a>, <a href="qml-qtquick-controls2-container.html#insertItem-method">insert</a>, <a href="qml-qtquick-controls2-container.html#moveItem-method">move</a> and <a href="qml-qtquick-controls2-container.html#removeItem-method">remove</a> items dynamically. The items in a container can be accessed using <a href="qml-qtquick-controls2-container.html#itemAt-method">itemAt()</a> or <a href="qml-qtquick-controls2-container.html#contentChildren-prop">contentChildren</a>.</p>
<p>Most containers have the concept of a "current" item. The current item is specified via the <a href="qml-qtquick-controls2-container.html#currentIndex-prop">currentIndex</a> property, and can be accessed using the read-only <a href="qml-qtquick-controls2-container.html#currentItem-prop">currentItem</a> property.</p>
<p>The following example illustrates dynamic insertion of items to a <a href="qtquickcontrols2-navigation.html#tabbar">TabBar</a>, which is one of the concrete implementations of Container.</p>
<pre class="cpp">
Row {
TabBar {
id: tabBar
currentIndex: <span class="number">0</span>
width: parent<span class="operator">.</span>width <span class="operator">-</span> addButton<span class="operator">.</span>width
TabButton { text: <span class="string">"TabButton"</span> }
}
Component {
id: tabButton
TabButton { text: <span class="string">"TabButton"</span> }
}
Button {
id: addButton
text: <span class="string">"+"</span>
flat: <span class="keyword">true</span>
onClicked: {
tabBar<span class="operator">.</span>addItem(tabButton<span class="operator">.</span>createObject(tabBar))
console<span class="operator">.</span>log(<span class="string">"added:"</span><span class="operator">,</span> tabBar<span class="operator">.</span>itemAt(tabBar<span class="operator">.</span>count <span class="operator">-</span> <span class="number">1</span>))
}
}
}
</pre>
<a name="implementing-containers"></a>
<h3 >Implementing Containers</h3>
<p>Container does not provide any default visualization. It is used to implement such containers as <a href="qml-qtquick-controls2-swipeview.html">SwipeView</a> and <a href="qtquickcontrols2-navigation.html#tabbar">TabBar</a>. When implementing a custom container, the most important part of the API is <a href="qml-qtquick-controls2-container.html#contentModel-prop">contentModel</a>, which provides the contained items in a way that it can be used as a delegate model for item views and repeaters.</p>
<pre class="cpp">
Container {
id: container
contentItem: ListView {
model: container<span class="operator">.</span>contentModel
snapMode: ListView<span class="operator">.</span>SnapOneItem
orientation: ListView<span class="operator">.</span>Horizontal
}
Text {
text: <span class="string">"Page 1"</span>
width: container<span class="operator">.</span>width
height: container<span class="operator">.</span>height
}
Text {
text: <span class="string">"Page 2"</span>
width: container<span class="operator">.</span>width
height: container<span class="operator">.</span>height
}
}
</pre>
<p>Notice how the sizes of the page items are set by hand. This is because the example uses a plain Container, which does not make any assumptions on the visual layout. It is typically not necessary to specify sizes for items in concrete Container implementations, such as <a href="qml-qtquick-controls2-swipeview.html">SwipeView</a> and <a href="qtquickcontrols2-navigation.html#tabbar">TabBar</a>.</p>
<p><b>See also </b><a href="qtquickcontrols2-containers.html">Container Controls</a>.</p>
<!-- @@@Container -->
<h2>Property Documentation</h2>
<!-- $$$contentChildren -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contentChildren-prop">
<td class="tblQmlPropNode"><p>
<a name="contentChildren-prop"></a><span class="name">contentChildren</span> : <span class="type">list</span><<span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the list of content children.</p>
<p>The list contains all items that have been declared in QML as children of the container, and also items that have been dynamically added or inserted using the <a href="qml-qtquick-controls2-container.html#addItem-method">addItem()</a> and <a href="qml-qtquick-controls2-container.html#insertItem-method">insertItem()</a> methods, respectively.</p>
<p><b>Note: </b>Unlike <code>contentData</code>, <code>contentChildren</code> does not include non-visual QML objects. It is re-ordered when items are inserted or moved.</p><p><b>See also </b><a href="../qtquick/qml-qtquick-item.html#children-prop">Item::children</a> and <a href="qml-qtquick-controls2-container.html#contentData-prop">contentData</a>.</p>
</div></div><!-- @@@contentChildren -->
<br/>
<!-- $$$contentData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contentData-prop">
<td class="tblQmlPropNode"><p>
<a name="contentData-prop"></a><span class="qmldefault">[default] </span><span class="name">contentData</span> : <span class="type">list</span><<span class="type">Object</span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the list of content data.</p>
<p>The list contains all objects that have been declared in QML as children of the container, and also items that have been dynamically added or inserted using the <a href="qml-qtquick-controls2-container.html#addItem-method">addItem()</a> and <a href="qml-qtquick-controls2-container.html#insertItem-method">insertItem()</a> methods, respectively.</p>
<p><b>Note: </b>Unlike <code>contentChildren</code>, <code>contentData</code> does include non-visual QML objects. It is not re-ordered when items are inserted or moved.</p><p><b>See also </b><a href="../qtquick/qml-qtquick-item.html#data-prop">Item::data</a> and <a href="qml-qtquick-controls2-container.html#contentChildren-prop">contentChildren</a>.</p>
</div></div><!-- @@@contentData -->
<br/>
<!-- $$$contentModel -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contentModel-prop">
<td class="tblQmlPropNode"><p>
<a name="contentModel-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">contentModel</span> : <span class="type">model</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the content model of items.</p>
<p>The content model is provided for visualization purposes. It can be assigned as a model to a content item that presents the contents of the container.</p>
<pre class="cpp">
Container {
id: container
contentItem: ListView {
model: container<span class="operator">.</span>contentModel
}
}
</pre>
<p><b>See also </b><a href="qml-qtquick-controls2-container.html#contentData-prop">contentData</a> and <a href="qml-qtquick-controls2-container.html#contentChildren-prop">contentChildren</a>.</p>
</div></div><!-- @@@contentModel -->
<br/>
<!-- $$$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="qmlreadonly">[read-only] </span><span class="name">count</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the number of items.</p>
</div></div><!-- @@@count -->
<br/>
<!-- $$$currentIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentIndex-prop">
<td class="tblQmlPropNode"><p>
<a name="currentIndex-prop"></a><span class="name">currentIndex</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the index of the current item.</p>
<p><b>See also </b><a href="qml-qtquick-controls2-container.html#currentItem-prop">currentItem</a>.</p>
</div></div><!-- @@@currentIndex -->
<br/>
<!-- $$$currentItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentItem-prop">
<td class="tblQmlPropNode"><p>
<a name="currentItem-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">currentItem</span> : <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the current item.</p>
<p><b>See also </b><a href="qml-qtquick-controls2-container.html#currentIndex-prop">currentIndex</a>.</p>
</div></div><!-- @@@currentItem -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$addItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="addItem-method">
<td class="tblQmlFuncNode"><p>
<a name="addItem-method"></a><span class="type">void</span> <span class="name">addItem</span>(<span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> <i>item</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds an <i>item</i>.</p>
</div></div><!-- @@@addItem -->
<br/>
<!-- $$$insertItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="insertItem-method">
<td class="tblQmlFuncNode"><p>
<a name="insertItem-method"></a><span class="type">void</span> <span class="name">insertItem</span>(<span class="type">int</span> <i>index</i>, <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> <i>item</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Inserts an <i>item</i> at <i>index</i>.</p>
</div></div><!-- @@@insertItem -->
<br/>
<!-- $$$itemAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="itemAt-method">
<td class="tblQmlFuncNode"><p>
<a name="itemAt-method"></a><span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> <span class="name">itemAt</span>(<span class="type">int</span> <i>index</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the item at <i>index</i>, or <code>null</code> if it does not exist.</p>
</div></div><!-- @@@itemAt -->
<br/>
<!-- $$$moveItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="moveItem-method">
<td class="tblQmlFuncNode"><p>
<a name="moveItem-method"></a><span class="type">void</span> <span class="name">moveItem</span>(<span class="type">int</span> <i>from</i>, <span class="type">int</span> <i>to</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Moves an item <i>from</i> one index <i>to</i> another.</p>
</div></div><!-- @@@moveItem -->
<br/>
<!-- $$$removeItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="removeItem-method">
<td class="tblQmlFuncNode"><p>
<a name="removeItem-method"></a><span class="type">void</span> <span class="name">removeItem</span>(<span class="type">int</span> <i>index</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes an item at <i>index</i>.</p>
<p><b>Note: </b>The ownership of the item is transferred to the caller.</p></div></div><!-- @@@removeItem -->
<br/>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2016 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>
|