This file is indexed.

/usr/share/qt5/doc/qtquicklayouts/qtquicklayouts-overview.html is in qtquickcontrols5-doc-html 5.3.2-2.

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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtquicklayouts-overview.qdoc -->
  <title>Qt Quick Layouts Overview | QtQuickLayouts 5.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.3</li>
<li><a href="qtquicklayouts-index.html">Qt Quick Layouts</a></li>
<li>Qt Quick Layouts Overview</li>
<li id="buildversion">
Qt 5.3.2 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#getting-started">Getting started</a></li>
<li class="level1"><a href="#key-features">Key Features</a></li>
<li class="level1"><a href="#size-constraints">Size Constraints</a></li>
<li class="level2"><a href="#specifying-preferred-size">Specifying Preferred Size</a></li>
<li class="level1"><a href="#connecting-windows-and-layouts">Connecting windows and layouts</a></li>
</ul>
</div>
<h1 class="title">Qt Quick Layouts Overview</h1>
<span class="subtitle"></span>
<!-- $$$qtquicklayouts-overview.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt Quick Layouts are items that are used to arrange items in a user interface. Since Qt Quick Layouts also resize their items, they are well suited for resizable user interfaces.</p>
<a name="getting-started"></a>
<h2>Getting started</h2>
<p>The QML types can be imported into your application using the following import statement in your <tt>.qml</tt> file.</p>
<pre class="cpp">import <span class="type"><a href="../qtquick/qtquick-module.html">QtQuick</a></span><span class="operator">.</span>Layouts <span class="number">1.1</span></pre>
<a name="key-features"></a>
<h2>Key Features</h2>
<p>Some of the key features are:</p>
<ul>
<li><a href="qml-qtquick-layouts-layout.html#alignment-prop">Alignment</a> of items can be specified with the <a href="qml-qtquick-layouts-layout.html#alignment-prop">Layout.alignment</a> property</li>
<li><a href="qml-qtquick-layouts-layout.html#fillWidth-prop">Resizable items</a> can be specified with the <a href="qml-qtquick-layouts-layout.html#fillWidth-prop">Layout.fillWidth</a> and <a href="qml-qtquick-layouts-layout.html#fillHeight-prop">Layout.fillHeight</a> properties.</li>
<li><a href="#size-constraints">Size constraints</a> can be specified with <a href="qml-qtquick-layouts-layout.html#minimumWidth-prop">Layout.minimumWidth</a>, <a href="qml-qtquick-layouts-layout.html#preferredWidth-prop">Layout.preferredWidth</a>, and <a href="qml-qtquick-layouts-layout.html#maximumWidth-prop">Layout.maximumWidth</a> properties (&quot;Width&quot; can be replaced with &quot;Height&quot; for specifying similar constraints to the height).</li>
<li><a href="qml-qtquick-layouts-rowlayout.html#spacing-prop">Spacings</a> can be specified with <a href="qml-qtquick-layouts-rowlayout.html#spacing-prop">spacing</a>, <a href="qml-qtquick-layouts-gridlayout.html#rowSpacing-prop">rowSpacing</a> or <a href="qml-qtquick-layouts-gridlayout.html#columnSpacing-prop">columnSpacing</a></li>
</ul>
<p>In addition to the above features, <a href="qml-qtquick-layouts-gridlayout.html">GridLayout</a> adds these features:</p>
<ul>
<li><a href="qml-qtquick-layouts-layout.html#row-prop">Grid coordinates</a> can be specified with the <a href="qml-qtquick-layouts-layout.html#row-prop">Layout.row</a> and <a href="qml-qtquick-layouts-layout.html#column-prop">Layout.column</a>.</li>
<li><a href="qml-qtquick-layouts-gridlayout.html#flow-prop">Automatic grid coordinates</a> used together with the <a href="qml-qtquick-layouts-gridlayout.html#flow-prop">flow</a>, <a href="qml-qtquick-layouts-gridlayout.html#rows-prop">rows</a>, and <a href="qml-qtquick-layouts-gridlayout.html#columns-prop">columns</a> properties.</li>
<li><a href="qml-qtquick-layouts-layout.html#columnSpan-prop">Spans</a> across rows or columns can be specified with the <a href="qml-qtquick-layouts-layout.html#rowSpan-prop">Layout.rowSpan</a> and <a href="qml-qtquick-layouts-layout.html#columnSpan-prop">Layout.columnSpan</a> properties.</li>
</ul>
<a name="size-constraints"></a>
<h2>Size Constraints</h2>
<p>Since an item can be resized by its layout, the layout needs to know the <a href="qml-qtquick-layouts-layout.html#minimumWidth-prop">minimum</a>, <a href="qml-qtquick-layouts-layout.html#preferredWidth-prop">preferred</a>, and <a href="qml-qtquick-layouts-layout.html#maximumWidth-prop">maximum</a> sizes of all items where <a href="qml-qtquick-layouts-layout.html#fillWidth-prop">Layout.fillWidth</a> or <a href="qml-qtquick-layouts-layout.html#fillHeight-prop">Layout.fillHeight</a> is set to <tt>true</tt>. For instance, the following will produce a layout with two rectangles lying side-by-side that stretches horizontally. The azure rectangle can be resized from 50x150 to 300x150, and the plum rectangle can be resized from 100x100 to ∞x100.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-layouts-rowlayout.html">RowLayout</a></span> {
    <span class="name">id</span>: <span class="name">layout</span>
    <span class="name">anchors</span>.fill: <span class="name">parent</span>
    <span class="name">spacing</span>: <span class="number">6</span>
    <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
        <span class="name">color</span>: <span class="string">'azure'</span>
        <span class="name">Layout</span>.fillWidth: <span class="number">true</span>
        <span class="name">Layout</span>.minimumWidth: <span class="number">50</span>
        <span class="name">Layout</span>.preferredWidth: <span class="number">100</span>
        <span class="name">Layout</span>.maximumWidth: <span class="number">300</span>
        <span class="name">Layout</span>.minimumHeight: <span class="number">150</span>
        <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
            <span class="name">anchors</span>.centerIn: <span class="name">parent</span>
            <span class="name">text</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="operator">+</span> <span class="string">'x'</span> <span class="operator">+</span> <span class="name">parent</span>.<span class="name">height</span>
        }
    }
    <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
        <span class="name">color</span>: <span class="string">'plum'</span>
        <span class="name">Layout</span>.fillWidth: <span class="number">true</span>
        <span class="name">Layout</span>.minimumWidth: <span class="number">100</span>
        <span class="name">Layout</span>.preferredWidth: <span class="number">200</span>
        <span class="name">Layout</span>.preferredHeight: <span class="number">100</span>
        <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
            <span class="name">anchors</span>.centerIn: <span class="name">parent</span>
            <span class="name">text</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="operator">+</span> <span class="string">'x'</span> <span class="operator">+</span> <span class="name">parent</span>.<span class="name">height</span>
        }
    }
}</pre>
<p class="centerAlign"><img src="images/rowlayout-minimum.png" alt="&quot;RowLayout at its minimum&quot;" /></p><p>Combining each item's constraints will give these implicit constraints to the layout element:</p>
<table class="generic">
 <thead><tr class="qt-style"><th ></th><th >minimum</th><th >preferred</th><th >maximum</th></tr></thead>
<tr valign="top" class="odd"><td >implicit constraints (width)</td><td >156</td><td >306</td><td >∞ (<tt>Number.POSITIVE_INFINITY</tt>)</td></tr>
<tr valign="top" class="even"><td >implicit constraints (heights)</td><td >150</td><td >150</td><td >150</td></tr>
</table>
<p>Thus, the layout cannot be narrower than 156 or be taller or shorter than 150 without breaking any of the constraints of its child items.</p>
<a name="specifying-preferred-size"></a>
<h3>Specifying Preferred Size</h3>
<p>For each item, the effective preferred size may come from one of several candidate properties. For determining the effective preferred size, it will query these candidate properties in the following order, and use the first candidate with a valid width or height.</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Candidate properties</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-layouts-layout.html#preferredWidth-prop">Layout.preferredWidth</a> or <a href="qml-qtquick-layouts-layout.html#preferredHeight-prop">Layout.preferredHeight</a></td><td >These properties are supposed to be modified by the application if the default implicit size does not give the optimal arrangement.</td></tr>
<tr valign="top" class="even"><td ><a href="../qtquick/qml-qtquick-item.html#implicitWidth-prop">implicitWidth</a> or <a href="../qtquick/qml-qtquick-item.html#implicitHeight-prop">implicitHeight</a></td><td >These properties are supposed to be supplied by each item to give a meaningful ideal size, for example the size needed to display all the contents of a <a href="../qtquick/qml-qtquick-text.html">Text</a> type. An implicit width or height of <tt>0</tt> is interpreted as invalid.</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtquick/qml-qtquick-item.html#width-prop">width</a> and <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a></td><td >If none of the above properties are valid, the layout will resort to the <a href="../qtquick/qml-qtquick-item.html#width-prop">width</a> and <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a> properties.</td></tr>
</table>
<p>An item can specify <a href="qml-qtquick-layouts-layout.html#preferredWidth-prop">Layout.preferredWidth</a> without having to specify <a href="qml-qtquick-layouts-layout.html#preferredHeight-prop">Layout.preferredHeight</a>. In this case, the effective preferred height will be determined from the <a href="../qtquick/qml-qtquick-item.html#implicitHeight-prop">implicitHeight</a> (or ultimately <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a>).</p>
<p><b>Note: </b>Resorting to <a href="../qtquick/qml-qtquick-item.html#width-prop">width</a> or <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a> properties is only provided as a final fallback. If you want to override the preferred size, it is recommended to use <a href="qml-qtquick-layouts-layout.html#preferredWidth-prop">Layout.preferredWidth</a> or <a href="qml-qtquick-layouts-layout.html#preferredHeight-prop">Layout.preferredHeight</a>. Relying on the <a href="../qtquick/qml-qtquick-item.html#width-prop">width</a> or <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a> properties for specifying the preferred size might give some unexpected behavior. For instance, changing the <a href="../qtquick/qml-qtquick-item.html#width-prop">width</a> or <a href="../qtquick/qml-qtquick-item.html#height-prop">height</a> properties won't trigger a layout rearrangement. Also, when the layout is forced to do a full rebuild it might use the actual width and height, and not the width and height specified in the QML file.</p><a name="connecting-windows-and-layouts"></a>
<h2>Connecting windows and layouts</h2>
<p>You can just use normal anchoring concepts to ensure that the layout will follow the window resizing.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-layouts-rowlayout.html">RowLayout</a></span> {
    <span class="name">id</span>: <span class="name">layout</span>
    <span class="name">anchors</span>.fill: <span class="name">parent</span></pre>
<p>The size constraints of layouts can be used to ensure that the window cannot be resized beyond the layout constraints. You can take the size constraints from the layout and set these constraints on the minimumWidth, minimumHeight, maximumWidth, and maximumHeight of the Window element. The following code ensures that the window cannot be resized beyond the constraints of the layout:</p>
<pre class="qml"><span class="name">minimumWidth</span>: <span class="name">layout</span>.<span class="name">Layout</span>.<span class="name">minimumWidth</span>
<span class="name">minimumHeight</span>: <span class="name">layout</span>.<span class="name">Layout</span>.<span class="name">minimumHeight</span>
<span class="name">maximumWidth</span>: <span class="number">1000</span>
<span class="name">maximumHeight</span>: <span class="name">layout</span>.<span class="name">Layout</span>.<span class="name">maximumHeight</span></pre>
<p><b>Note: </b>Since layout.Layout.maximumWidth is infinite in this case, we cannot bind that to the maximumWidth property of Window, since that is an integer number. We therefore set a fixed maximum width to 1000.</p><p>Finally, you usually want the initial size of the window to be the layout's implicit size:</p>
<pre class="qml"><span class="name">width</span>: <span class="name">layout</span>.<span class="name">implicitWidth</span>
<span class="name">height</span>: <span class="name">layout</span>.<span class="name">implicitHeight</span></pre>
</div>
<!-- @@@qtquicklayouts-overview.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2014 Digia Plc and/or its
   subsidiaries. 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>    Digia, Qt and their respective logos are trademarks of Digia Plc     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>