/usr/share/qt5/doc/qtquick/qml-qtquick-grid.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickpositioners.cpp -->
<title>Grid QML Type | Qt Quick 5.5</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.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li><a href="qtquick-qmlmodule.html">QML Types</a></li>
<li>Grid QML Type</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</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="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Grid QML Type</h1>
<span class="subtitle"></span>
<!-- $$$Grid-brief -->
<p>Positions its children in grid formation <a href="#details">More...</a></p>
<!-- @@@Grid -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.5</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-item.html">Item</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-grid-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-grid.html#add-prop">add</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#columnSpacing-prop">columnSpacing</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#columns-prop">columns</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#effectiveHorizontalItemAlignment-prop">effectiveHorizontalItemAlignment</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#effectiveLayoutDirection-prop">effectiveLayoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#flow-prop">flow</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#horizontalItemAlignment-prop">horizontalItemAlignment</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#move-prop">move</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#populate-prop">populate</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#rowSpacing-prop">rowSpacing</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#rows-prop">rows</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#spacing-prop">spacing</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-grid.html#verticalItemAlignment-prop">verticalItemAlignment</a></b></b> : enumeration</li>
</ul>
<!-- $$$Grid-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<p>Grid is a type that positions its child items in grid formation.</p>
<p>A Grid creates a grid of cells that is large enough to hold all of its child items, and places these items in the cells from left to right and top to bottom. Each item is positioned at the top-left corner of its cell with position (0, 0).</p>
<p>A Grid defaults to four columns, and creates as many rows as are necessary to fit all of its child items. The number of rows and columns can be constrained by setting the <a href="qml-qtquick-grid.html#rows-prop">rows</a> and <a href="qml-qtquick-grid.html#columns-prop">columns</a> properties.</p>
<p>For example, below is a Grid that contains five rectangles of various sizes:</p>
<pre class="qml">import QtQuick 2.0
<span class="type"><a href="qml-qtquick-grid.html">Grid</a></span> {
<span class="name">columns</span>: <span class="number">3</span>
<span class="name">spacing</span>: <span class="number">2</span>
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">color</span>: <span class="string">"red"</span>; <span class="name">width</span>: <span class="number">50</span>; <span class="name">height</span>: <span class="number">50</span> }
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">color</span>: <span class="string">"green"</span>; <span class="name">width</span>: <span class="number">20</span>; <span class="name">height</span>: <span class="number">50</span> }
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">color</span>: <span class="string">"blue"</span>; <span class="name">width</span>: <span class="number">50</span>; <span class="name">height</span>: <span class="number">20</span> }
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">color</span>: <span class="string">"cyan"</span>; <span class="name">width</span>: <span class="number">50</span>; <span class="name">height</span>: <span class="number">50</span> }
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">color</span>: <span class="string">"magenta"</span>; <span class="name">width</span>: <span class="number">10</span>; <span class="name">height</span>: <span class="number">10</span> }
}</pre>
<p>The Grid automatically positions the child items in a grid formation:</p>
<p class="centerAlign"><img src="images/gridLayout_example.png" alt="" /></p><p>If an item within a Grid is not <a href="qml-qtquick-item.html#visible-prop">visible</a>, or if it has a width or height of 0, the item will not be laid out and it will not be visible within the column. Also, since a Grid automatically positions its children, a child item within a Grid should not set its <a href="qml-qtquick-item.html#x-prop">x</a> or <a href="qml-qtquick-item.html#y-prop">y</a> positions or anchor itself with any of the <a href="qml-qtquick-item.html#anchors-prop">anchor</a> properties.</p>
<p>For more information on using Grid and other related positioner-types, see <a href="qtquick-positioning-layouts.html">Item Positioners</a>.</p>
<p><b>See also </b><a href="qtquick-positioning-layouts.html#flow">Flow</a>, <a href="qtquick-positioning-layouts.html#row">Row</a>, <a href="qtquick-positioning-layouts.html#column">Column</a>, <a href="qml-qtquick-positioner.html">Positioner</a>, GridLayout, and <a href="qtquick-positioners-example.html">Qt Quick Examples - Positioners</a>.</p>
<!-- @@@Grid -->
<h2>Property Documentation</h2>
<!-- $$$add -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="add-prop"><td class="tblQmlPropNode"><p><a name="add-prop"></a><span class="name">add</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to be run for items that are added to this positioner. For a positioner, this applies to:</p>
<ul>
<li>Items that are created or reparented as a child of the positioner after the positioner has been created</li>
<li>Child items that change their <a href="qml-qtquick-item.html#visible-prop">Item::visible</a> property from false to true, and thus are now visible</li>
</ul>
<p>The transition can use the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> property to access more details about the item that is being added. See the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation for more details and examples on using these transitions.</p>
<p><b>Note: </b>This transition is not applied to the items that already part of the positioner at the time of its creation. In this case, the <a href="qml-qtquick-grid.html#populate-prop">populate</a> transition is applied instead.</p><p><b>See also </b><a href="qml-qtquick-grid.html#populate-prop">populate</a>, <a href="qml-qtquick-viewtransition.html">ViewTransition</a>, and <a href="qtquick-positioners-example.html">Qt Quick Examples - Positioners</a>.</p>
</div></div><!-- @@@add -->
<br/>
<!-- $$$columnSpacing -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="columnSpacing-prop"><td class="tblQmlPropNode"><p><a name="columnSpacing-prop"></a><span class="name">columnSpacing</span> : <span class="type">qreal</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the spacing in pixels between columns.</p>
<p>If this property is not set, then spacing is used for the column spacing.</p>
<p>By default this property is not set.</p>
<p>This QML property was introduced in Qt 5.0.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#rowSpacing-prop">rowSpacing</a>.</p>
</div></div><!-- @@@columnSpacing -->
<br/>
<!-- $$$columns -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="columns-prop"><td class="tblQmlPropNode"><p><a name="columns-prop"></a><span class="name">columns</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the number of columns in the grid. The default number of columns is 4.</p>
<p>If the grid does not have enough items to fill the specified number of columns, some columns will be of zero width.</p>
</div></div><!-- @@@columns -->
<br/>
<!-- $$$effectiveHorizontalItemAlignment -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="effectiveHorizontalItemAlignment-prop"><td class="tblQmlPropNode"><p><a name="effectiveHorizontalItemAlignment-prop"></a><span class="name">effectiveHorizontalItemAlignment</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of items in the Grid. By default, the items are vertically aligned to the top. Horizontal alignment follows the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> of the Grid, for example when having a <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> from LeftToRight, the items will be aligned on the left.</p>
<p>The valid values for <code>horizontalItemAlignment</code> are, <code>Grid.AlignLeft</code>, <code>Grid.AlignRight</code> and <code>Grid.AlignHCenter</code>.</p>
<p>The valid values for <code>verticalItemAlignment</code> are <code>Grid.AlignTop</code>, <code>Grid.AlignBottom</code> and <code>Grid.AlignVCenter</code>.</p>
<p>The below images show three examples of how to align items.</p>
<div class="table"><table class="generic">
<tr valign="top" class="odd"><td ></td><td ><img src="images/gridLayout_aligntopleft.png" alt="" /></td><td ><img src="images/gridLayout_aligntop.png" alt="" /></td><td ><img src="images/gridLayout_aligncenter.png" alt="" /></td></tr>
<tr valign="top" class="even"><td >Horizontal alignment</td><td >AlignLeft</td><td >AlignHCenter</td><td >AlignHCenter</td></tr>
<tr valign="top" class="odd"><td >Vertical alignment</td><td >AlignTop</td><td >AlignTop</td><td >AlignVCenter</td></tr>
</table></div>
<p>When mirroring the layout using either the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> or by setting the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a>, the horizontal alignment of items will be mirrored as well. However, the property <code>horizontalItemAlignment</code> will remain unchanged. To query the effective horizontal alignment of items, use the read-only property <code>effectiveHorizontalItemAlignment</code>.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#layoutDirection-prop">Grid::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@effectiveHorizontalItemAlignment -->
<br/>
<!-- $$$effectiveLayoutDirection -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="effectiveLayoutDirection-prop"><td class="tblQmlPropNode"><p><a name="effectiveLayoutDirection-prop"></a><span class="name">effectiveLayoutDirection</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the effective layout direction of the grid.</p>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> for locale layouts, the visual layout direction of the grid positioner will be mirrored. However, the property <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> will remain unchanged.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#layoutDirection-prop">Grid::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@effectiveLayoutDirection -->
<br/>
<!-- $$$flow -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="flow-prop"><td class="tblQmlPropNode"><p><a name="flow-prop"></a><span class="name">flow</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the flow of the layout.</p>
<p>Possible values are:</p>
<ul>
<li>Grid.LeftToRight (default) - Items are positioned next to each other in the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a>, then wrapped to the next line.</li>
<li>Grid.TopToBottom - Items are positioned next to each other from top to bottom, then wrapped to the next column.</li>
</ul>
</div></div><!-- @@@flow -->
<br/>
<!-- $$$horizontalItemAlignment -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="horizontalItemAlignment-prop"><td class="tblQmlPropNode"><p><a name="horizontalItemAlignment-prop"></a><span class="name">horizontalItemAlignment</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of items in the Grid. By default, the items are vertically aligned to the top. Horizontal alignment follows the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> of the Grid, for example when having a <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> from LeftToRight, the items will be aligned on the left.</p>
<p>The valid values for <code>horizontalItemAlignment</code> are, <code>Grid.AlignLeft</code>, <code>Grid.AlignRight</code> and <code>Grid.AlignHCenter</code>.</p>
<p>The valid values for <code>verticalItemAlignment</code> are <code>Grid.AlignTop</code>, <code>Grid.AlignBottom</code> and <code>Grid.AlignVCenter</code>.</p>
<p>The below images show three examples of how to align items.</p>
<div class="table"><table class="generic">
<tr valign="top" class="odd"><td ></td><td ><img src="images/gridLayout_aligntopleft.png" alt="" /></td><td ><img src="images/gridLayout_aligntop.png" alt="" /></td><td ><img src="images/gridLayout_aligncenter.png" alt="" /></td></tr>
<tr valign="top" class="even"><td >Horizontal alignment</td><td >AlignLeft</td><td >AlignHCenter</td><td >AlignHCenter</td></tr>
<tr valign="top" class="odd"><td >Vertical alignment</td><td >AlignTop</td><td >AlignTop</td><td >AlignVCenter</td></tr>
</table></div>
<p>When mirroring the layout using either the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> or by setting the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a>, the horizontal alignment of items will be mirrored as well. However, the property <code>horizontalItemAlignment</code> will remain unchanged. To query the effective horizontal alignment of items, use the read-only property <code>effectiveHorizontalItemAlignment</code>.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#layoutDirection-prop">Grid::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@horizontalItemAlignment -->
<br/>
<!-- $$$layoutDirection -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="layoutDirection-prop"><td class="tblQmlPropNode"><p><a name="layoutDirection-prop"></a><span class="name">layoutDirection</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the layout direction of the layout.</p>
<p>Possible values are:</p>
<ul>
<li>Qt.LeftToRight (default) - Items are positioned from the top to bottom, and left to right. The flow direction is dependent on the <a href="qml-qtquick-grid.html#flow-prop">Grid::flow</a> property.</li>
<li>Qt.RightToLeft - Items are positioned from the top to bottom, and right to left. The flow direction is dependent on the <a href="qml-qtquick-grid.html#flow-prop">Grid::flow</a> property.</li>
</ul>
<p><b>See also </b><a href="qml-qtquick-flow.html#layoutDirection-prop">Flow::layoutDirection</a>, <a href="qml-qtquick-row.html#layoutDirection-prop">Row::layoutDirection</a>, and <a href="qtquick-righttoleft-example.html">Qt Quick Examples - Right to Left</a>.</p>
</div></div><!-- @@@layoutDirection -->
<br/>
<!-- $$$move -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="move-prop"><td class="tblQmlPropNode"><p><a name="move-prop"></a><span class="name">move</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to run for items that have moved within the positioner. For a positioner, this applies to:</p>
<ul>
<li>Child items that move when they are displaced due to the addition, removal or rearrangement of other items in the positioner</li>
<li>Child items that are repositioned due to the resizing of other items in the positioner</li>
</ul>
<p>The transition can use the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> property to access more details about the item that is being moved. Note, however, that for this move transition, the <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.targetIndexes and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.targetItems lists are only set when this transition is triggered by the addition of other items in the positioner; in other cases, these lists will be empty. See the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation for more details and examples on using these transitions.</p>
<p><b>Note: </b>In Qt Quick 1, this transition was applied to all items that were part of the positioner at the time of its creation. From <a href="qtquick-index.html">QtQuick 2</a> onwards, positioners apply the <a href="qml-qtquick-grid.html#populate-prop">populate</a> transition to these items instead.</p><p><b>See also </b><a href="qml-qtquick-grid.html#add-prop">add</a>, <a href="qml-qtquick-viewtransition.html">ViewTransition</a>, and <a href="qtquick-positioners-example.html">Qt Quick Examples - Positioners</a>.</p>
</div></div><!-- @@@move -->
<br/>
<!-- $$$populate -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="populate-prop"><td class="tblQmlPropNode"><p><a name="populate-prop"></a><span class="name">populate</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to be run for items that are part of this positioner at the time of its creation. The transition is run when the positioner is first created.</p>
<p>The transition can use the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> property to access more details about the item that is being added. See the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation for more details and examples on using these transitions.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#add-prop">add</a>, <a href="qml-qtquick-viewtransition.html">ViewTransition</a>, and <a href="qtquick-positioners-example.html">Qt Quick Examples - Positioners</a>.</p>
</div></div><!-- @@@populate -->
<br/>
<!-- $$$rowSpacing -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="rowSpacing-prop"><td class="tblQmlPropNode"><p><a name="rowSpacing-prop"></a><span class="name">rowSpacing</span> : <span class="type">qreal</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the spacing in pixels between rows.</p>
<p>If this property is not set, then spacing is used for the row spacing.</p>
<p>By default this property is not set.</p>
<p>This QML property was introduced in Qt 5.0.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#columnSpacing-prop">columnSpacing</a>.</p>
</div></div><!-- @@@rowSpacing -->
<br/>
<!-- $$$rows -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="rows-prop"><td class="tblQmlPropNode"><p><a name="rows-prop"></a><span class="name">rows</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the number of rows in the grid.</p>
<p>If the grid does not have enough items to fill the specified number of rows, some rows will be of zero width.</p>
</div></div><!-- @@@rows -->
<br/>
<!-- $$$spacing -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="spacing-prop"><td class="tblQmlPropNode"><p><a name="spacing-prop"></a><span class="name">spacing</span> : <span class="type">qreal</span></p></td></tr></table></div></div><div class="qmldoc"><p>The spacing is the amount in pixels left empty between adjacent items. The amount of spacing applied will be the same in the horizontal and vertical directions. The default spacing is 0.</p>
<p>The below example places a Grid containing a red, a blue and a green rectangle on a gray background. The area the grid positioner occupies is colored white. The positioner on the left has the no spacing (the default), and the positioner on the right has a spacing of 6.</p>
<p><img src="images/qml-grid-no-spacing.png" alt="" /> <img src="images/qml-grid-spacing.png" alt="" /></p>
<p><b>See also </b><a href="qml-qtquick-grid.html#rows-prop">rows</a> and <a href="qml-qtquick-grid.html#columns-prop">columns</a>.</p>
</div></div><!-- @@@spacing -->
<br/>
<!-- $$$verticalItemAlignment -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="verticalItemAlignment-prop"><td class="tblQmlPropNode"><p><a name="verticalItemAlignment-prop"></a><span class="name">verticalItemAlignment</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of items in the Grid. By default, the items are vertically aligned to the top. Horizontal alignment follows the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> of the Grid, for example when having a <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a> from LeftToRight, the items will be aligned on the left.</p>
<p>The valid values for <code>horizontalItemAlignment</code> are, <code>Grid.AlignLeft</code>, <code>Grid.AlignRight</code> and <code>Grid.AlignHCenter</code>.</p>
<p>The valid values for <code>verticalItemAlignment</code> are <code>Grid.AlignTop</code>, <code>Grid.AlignBottom</code> and <code>Grid.AlignVCenter</code>.</p>
<p>The below images show three examples of how to align items.</p>
<div class="table"><table class="generic">
<tr valign="top" class="odd"><td ></td><td ><img src="images/gridLayout_aligntopleft.png" alt="" /></td><td ><img src="images/gridLayout_aligntop.png" alt="" /></td><td ><img src="images/gridLayout_aligncenter.png" alt="" /></td></tr>
<tr valign="top" class="even"><td >Horizontal alignment</td><td >AlignLeft</td><td >AlignHCenter</td><td >AlignHCenter</td></tr>
<tr valign="top" class="odd"><td >Vertical alignment</td><td >AlignTop</td><td >AlignTop</td><td >AlignVCenter</td></tr>
</table></div>
<p>When mirroring the layout using either the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> or by setting the <a href="qml-qtquick-grid.html#layoutDirection-prop">layoutDirection</a>, the horizontal alignment of items will be mirrored as well. However, the property <code>horizontalItemAlignment</code> will remain unchanged. To query the effective horizontal alignment of items, use the read-only property <code>effectiveHorizontalItemAlignment</code>.</p>
<p><b>See also </b><a href="qml-qtquick-grid.html#layoutDirection-prop">Grid::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@verticalItemAlignment -->
<br/>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 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>
|