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 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFormLayout Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFormLayout Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFormLayout class manages forms of input widgets and their
associated labels. <a href="#details">More...</a></p>
<p>Inherits <a href="qlayout.html">QLayout</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qformlayout.html#FieldGrowthPolicy-enum">FieldGrowthPolicy</a></b> { FieldsStayAtSizeHint, ExpandingFieldsGrow, AllNonFixedFieldsGrow }</li><li><div class="fn" />enum <b><a href="qformlayout.html#ItemRole-enum">ItemRole</a></b> { LabelRole, FieldRole, SpanningRole }</li><li><div class="fn" />enum <b><a href="qformlayout.html#RowWrapPolicy-enum">RowWrapPolicy</a></b> { DontWrapRows, WrapLongRows, WrapAllRows }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qformlayout.html#QFormLayout">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qformlayout.html#addItem">addItem</a></b> (<i>self</i>, QLayoutItem <i>item</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow">addRow</a></b> (<i>self</i>, QWidget <i>label</i>, QWidget <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow-2">addRow</a></b> (<i>self</i>, QWidget <i>label</i>, QLayout <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow-3">addRow</a></b> (<i>self</i>, QString <i>labelText</i>, QWidget <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow-4">addRow</a></b> (<i>self</i>, QString <i>labelText</i>, QLayout <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow-5">addRow</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#addRow-6">addRow</a></b> (<i>self</i>, QLayout <i>layout</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Orientations <b><a href="qformlayout.html#expandingDirections">expandingDirections</a></b> (<i>self</i>)</li><li><div class="fn" />FieldGrowthPolicy <b><a href="qformlayout.html#fieldGrowthPolicy">fieldGrowthPolicy</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Alignment <b><a href="qformlayout.html#formAlignment">formAlignment</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>rowPtr</i>, ItemRole <i>rolePtr</i>) <b><a href="qformlayout.html#getItemPosition">getItemPosition</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />(int <i>rowPtr</i>, ItemRole <i>rolePtr</i>) <b><a href="qformlayout.html#getLayoutPosition">getLayoutPosition</a></b> (<i>self</i>, QLayout <i>layout</i>)</li><li><div class="fn" />(int <i>rowPtr</i>, ItemRole <i>rolePtr</i>) <b><a href="qformlayout.html#getWidgetPosition">getWidgetPosition</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" />bool <b><a href="qformlayout.html#hasHeightForWidth">hasHeightForWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#heightForWidth">heightForWidth</a></b> (<i>self</i>, int <i>width</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#horizontalSpacing">horizontalSpacing</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow">insertRow</a></b> (<i>self</i>, int <i>row</i>, QWidget <i>label</i>, QWidget <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow-2">insertRow</a></b> (<i>self</i>, int <i>row</i>, QWidget <i>label</i>, QLayout <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow-3">insertRow</a></b> (<i>self</i>, int <i>row</i>, QString <i>labelText</i>, QWidget <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow-4">insertRow</a></b> (<i>self</i>, int <i>row</i>, QString <i>labelText</i>, QLayout <i>field</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow-5">insertRow</a></b> (<i>self</i>, int <i>row</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#insertRow-6">insertRow</a></b> (<i>self</i>, int <i>row</i>, QLayout <i>layout</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#invalidate">invalidate</a></b> (<i>self</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qformlayout.html#itemAt">itemAt</a></b> (<i>self</i>, int <i>row</i>, ItemRole <i>role</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qformlayout.html#itemAt-2">itemAt</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />Qt.Alignment <b><a href="qformlayout.html#labelAlignment">labelAlignment</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qformlayout.html#labelForField">labelForField</a></b> (<i>self</i>, QWidget <i>field</i>)</li><li><div class="fn" />QWidget <b><a href="qformlayout.html#labelForField-2">labelForField</a></b> (<i>self</i>, QLayout <i>field</i>)</li><li><div class="fn" />QSize <b><a href="qformlayout.html#minimumSize">minimumSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#rowCount">rowCount</a></b> (<i>self</i>)</li><li><div class="fn" />RowWrapPolicy <b><a href="qformlayout.html#rowWrapPolicy">rowWrapPolicy</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setFieldGrowthPolicy">setFieldGrowthPolicy</a></b> (<i>self</i>, FieldGrowthPolicy <i>policy</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setFormAlignment">setFormAlignment</a></b> (<i>self</i>, Qt.Alignment <i>alignment</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setGeometry">setGeometry</a></b> (<i>self</i>, QRect <i>rect</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setHorizontalSpacing">setHorizontalSpacing</a></b> (<i>self</i>, int <i>spacing</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setItem">setItem</a></b> (<i>self</i>, int <i>row</i>, ItemRole <i>role</i>, QLayoutItem <i>item</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setLabelAlignment">setLabelAlignment</a></b> (<i>self</i>, Qt.Alignment <i>alignment</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setLayout">setLayout</a></b> (<i>self</i>, int <i>row</i>, ItemRole <i>role</i>, QLayout <i>layout</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setRowWrapPolicy">setRowWrapPolicy</a></b> (<i>self</i>, RowWrapPolicy <i>policy</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setSpacing">setSpacing</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qformlayout.html#setVerticalSpacing">setVerticalSpacing</a></b> (<i>self</i>, int <i>spacing</i>)</li><li><div class="fn" /><b><a href="qformlayout.html#setWidget">setWidget</a></b> (<i>self</i>, int <i>row</i>, ItemRole <i>role</i>, QWidget <i>widget</i>)</li><li><div class="fn" />QSize <b><a href="qformlayout.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#spacing">spacing</a></b> (<i>self</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qformlayout.html#takeAt">takeAt</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />int <b><a href="qformlayout.html#verticalSpacing">verticalSpacing</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFormLayout class manages forms of input widgets and their
associated labels.</p>
<p>QFormLayout is a convenience layout class that lays out its
children in a two-column form. The left column consists of labels
and the right column consists of "field" widgets (line editors,
spin boxes, etc.).</p>
<p>Traditionally, such two-column form layouts were achieved using
<a href="qgridlayout.html">QGridLayout</a>. QFormLayout is a
higher-level alternative that provides the following
advantages:</p>
<ul>
<li><b>Adherence to the different platform's look and feel
guidelines.</b>
<p>For example, the <a href="http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html">
Mac OS X Aqua</a> and KDE guidelines specify that the labels should
be right-aligned, whereas Windows and GNOME applications normally
use left-alignment.</p>
</li>
<li><b>Support for wrapping long rows.</b>
<p>For devices with small displays, QFormLayout can be set to
<a href="qformlayout.html#RowWrapPolicy-enum">wrap long rows</a>,
or even to <a href="qformlayout.html#RowWrapPolicy-enum">wrap all
rows</a>.</p>
</li>
<li><b>Convenient API for creating label--field pairs.</b>
<p>The <a href="qformlayout.html#addRow">addRow</a>() overload that
takes a <a href="qstring.html">QString</a> and a <a href="qwidget.html">QWidget</a> * creates a <a href="qlabel.html">QLabel</a> behind the scenes and automatically set up
its buddy. We can then write code like this:</p>
<pre class="cpp">
<span class="type">QFormLayout</span> <span class="operator">*</span>formLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QFormLayout</span>;
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#addRow">addRow</a>(tr(<span class="string">"&Name:"</span>)<span class="operator">,</span> nameLineEdit);
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#addRow">addRow</a>(tr(<span class="string">"&Email:"</span>)<span class="operator">,</span> emailLineEdit);
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#addRow">addRow</a>(tr(<span class="string">"&Age:"</span>)<span class="operator">,</span> ageSpinBox);
<a href="qformlayout.html#setLayout">setLayout</a>(formLayout);
</pre>
<p>Compare this with the following code, written using <a href="qgridlayout.html">QGridLayout</a>:</p>
<pre class="cpp">
nameLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">"&Name:"</span>));
nameLabel<span class="operator">-</span><span class="operator">></span>setBuddy(nameLineEdit);
emailLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">"&Name:"</span>));
emailLabel<span class="operator">-</span><span class="operator">></span>setBuddy(emailLineEdit);
ageLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(tr(<span class="string">"&Name:"</span>));
ageLabel<span class="operator">-</span><span class="operator">></span>setBuddy(ageSpinBox);
<span class="type"><a href="qgridlayout.html">QGridLayout</a></span> <span class="operator">*</span>gridLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgridlayout.html">QGridLayout</a></span>;
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(nameLabel<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(nameLineEdit<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(emailLabel<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(emailLineEdit<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(ageLabel<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">0</span>);
gridLayout<span class="operator">-</span><span class="operator">></span><a href="qlayout.html#addWidget">addWidget</a>(ageSpinBox<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">1</span>);
<a href="qformlayout.html#setLayout">setLayout</a>(gridLayout);
</pre></li>
</ul>
<p>The table below shows the default appearance in different
styles.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th><a href="qcommonstyle.html">QCommonStyle</a> derived styles
(except <a href="qplastiquestyle.html">QPlastiqueStyle</a>)</th>
<th><a href="qmacstyle.html">QMacStyle</a></th>
<th><a href="qplastiquestyle.html">QPlastiqueStyle</a></th>
<th>Qt Extended styles</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/qformlayout-win.png" /></td>
<td><img alt="" src="images/qformlayout-mac.png" /></td>
<td><img alt="" src="images/qformlayout-kde.png" /></td>
<td><img alt="" src="images/qformlayout-qpe.png" /></td>
</tr>
<tr class="even" valign="top">
<td>Traditional style used for Windows, GNOME, and earlier versions
of KDE. Labels are left aligned, and expanding fields grow to fill
the available space. (This normally corresponds to what we would
get using a two-column <a href="qgridlayout.html">QGridLayout</a>.)</td>
<td>Style based on the <a href="http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html">
Mac OS X Aqua</a> guidelines. Labels are right-aligned, the fields
don't grow beyond their size hint, and the form is horizontally
centered.</td>
<td>Recommended style for <a href="http://www.kdedevelopers.org/node/2345">KDE applications</a>.
Similar to MacStyle, except that the form is left-aligned and all
fields grow to fill the available space.</td>
<td>Default style for Qt Extended styles. Labels are right-aligned,
expanding fields grow to fill the available space, and row wrapping
is enabled for long lines.</td>
</tr>
</table>
<p>The form styles can be also be overridden individually by
calling <a href="qformlayout.html#labelAlignment-prop">setLabelAlignment</a>(),
<a href="qformlayout.html#formAlignment-prop">setFormAlignment</a>(),
<a href="qformlayout.html#fieldGrowthPolicy-prop">setFieldGrowthPolicy</a>(),
and <a href="qformlayout.html#rowWrapPolicy-prop">setRowWrapPolicy</a>(). For
example, to simulate the form layout appearance of <a href="qmacstyle.html">QMacStyle</a> on all platforms, but with
left-aligned labels, you could write:</p>
<pre class="cpp">
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#rowWrapPolicy-prop">setRowWrapPolicy</a>(<span class="type">QFormLayout</span><span class="operator">.</span>DontWrapRows);
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#fieldGrowthPolicy-prop">setFieldGrowthPolicy</a>(<span class="type">QFormLayout</span><span class="operator">.</span>FieldsStayAtSizeHint);
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#formAlignment-prop">setFormAlignment</a>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignHCenter <span class="operator">|</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignTop);
formLayout<span class="operator">-</span><span class="operator">></span><a href="qformlayout.html#labelAlignment-prop">setLabelAlignment</a>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignLeft);
</pre><hr /><h2>Type Documentation</h2><h3 class="fn"><a name="FieldGrowthPolicy-enum" />QFormLayout.FieldGrowthPolicy</h3><p>This enum specifies the different policies that can be used to
control the way in which the form's fields grow.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QFormLayout.FieldsStayAtSizeHint</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The fields never grow beyond their <a href="qwidgetitem.html#sizeHint">effective size hint</a>. This is the
default for <a href="qmacstyle.html">QMacStyle</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.ExpandingFieldsGrow</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Fields with an horizontal <a href="qsizepolicy.html">size policy</a> of <a href="qsizepolicy.html#Policy-enum">Expanding</a> or <a href="qsizepolicy.html#Policy-enum">MinimumExpanding</a> will grow to
fill the available space. The other fields will not grow beyond
their effective size hint. This is the default policy for
Plastique.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QFormLayout.AllNonFixedFieldsGrow</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">All fields with a size policy that allows them
to grow will grow to fill the available space. This is the default
policy for most styles.</td>
</tr>
</table>
<p><b>See also</b> <a href="qformlayout.html#fieldGrowthPolicy-prop">fieldGrowthPolicy</a>.</p>
<h3 class="fn"><a name="ItemRole-enum" />QFormLayout.ItemRole</h3><p>This enum specifies the types of widgets (or other layout items)
that may appear in a row.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.LabelRole</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A label widget.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.FieldRole</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">A field widget.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.SpanningRole</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">A widget that spans label and field
columns.</td>
</tr>
</table>
<p><b>See also</b> <a href="qformlayout.html#itemAt">itemAt</a>()
and <a href="qformlayout.html#getItemPosition">getItemPosition</a>().</p>
<h3 class="fn"><a name="RowWrapPolicy-enum" />QFormLayout.RowWrapPolicy</h3><p>This enum specifies the different policies that can be used to
control the way in which the form's rows wrap.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.DontWrapRows</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Fields are always laid out next to their
label. This is the default policy for all styles except Qt Extended
styles and <a href="qs60style.html">QS60Style</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.WrapLongRows</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Labels are given enough horizontal space to
fit the widest label, and the rest of the space is given to the
fields. If the minimum size of a field pair is wider than the
available space, the field is wrapped to the next line. This is the
default policy for Qt Extended styles and and <a href="qs60style.html">QS60Style</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFormLayout.WrapAllRows</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Fields are always laid out below their
label.</td>
</tr>
</table>
<p><b>See also</b> <a href="qformlayout.html#rowWrapPolicy-prop">rowWrapPolicy</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFormLayout" />QFormLayout.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new form layout with the given <i>parent</i>
widget.</p>
<p><b>See also</b> <a href="qwidget.html#setLayout">QWidget.setLayout</a>().</p>
<h3 class="fn"><a name="addItem" />QFormLayout.addItem (<i>self</i>, <a href="qlayoutitem.html">QLayoutItem</a> <i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Reimplemented from <a href="qlayout.html#addItem">QLayout.addItem</a>().</p>
<h3 class="fn"><a name="addRow" />QFormLayout.addRow (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>label</i>, <a href="qwidget.html">QWidget</a> <i>field</i>)</h3><p>The <i>label</i> argument has it's ownership transferred to Qt.</p><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>Adds a new row to the bottom of this form layout, with the given
<i>label</i> and <i>field</i>.</p>
<p><b>See also</b> <a href="qformlayout.html#insertRow">insertRow</a>().</p>
<h3 class="fn"><a name="addRow-2" />QFormLayout.addRow (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>label</i>, <a href="qlayout.html">QLayout</a> <i>field</i>)</h3><p>The <i>label</i> argument has it's ownership transferred to Qt.</p><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<h3 class="fn"><a name="addRow-3" />QFormLayout.addRow (<i>self</i>, QString <i>labelText</i>, <a href="qwidget.html">QWidget</a> <i>field</i>)</h3><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>This overload automatically creates a <a href="qlabel.html">QLabel</a> behind the scenes with <i>labelText</i> as
its text. The <i>field</i> is set as the new <a href="qlabel.html">QLabel</a>'s <a href="qlabel.html#setBuddy">buddy</a>.</p>
<h3 class="fn"><a name="addRow-4" />QFormLayout.addRow (<i>self</i>, QString <i>labelText</i>, <a href="qlayout.html">QLayout</a> <i>field</i>)</h3><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>This overload automatically creates a <a href="qlabel.html">QLabel</a> behind the scenes with <i>labelText</i> as
its text.</p>
<h3 class="fn"><a name="addRow-5" />QFormLayout.addRow (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>Adds the specified <i>widget</i> at the end of this form layout.
The <i>widget</i> spans both columns.</p>
<h3 class="fn"><a name="addRow-6" />QFormLayout.addRow (<i>self</i>, <a href="qlayout.html">QLayout</a> <i>layout</i>)</h3><p>The <i>layout</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>Adds the specified <i>layout</i> at the end of this form layout.
The <i>layout</i> spans both columns.</p>
<h3 class="fn"><a name="count" />int QFormLayout.count (<i>self</i>)</h3><p>Reimplemented from <a href="qlayout.html#count">QLayout.count</a>().</p>
<h3 class="fn"><a name="expandingDirections" /><a href="qt-orientations.html">Qt.Orientations</a> QFormLayout.expandingDirections (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem.expandingDirections</a>().</p>
<h3 class="fn"><a name="fieldGrowthPolicy" /><a href="qformlayout.html#FieldGrowthPolicy-enum">FieldGrowthPolicy</a> QFormLayout.fieldGrowthPolicy (<i>self</i>)</h3><h3 class="fn"><a name="formAlignment" /><a href="qt-alignment.html">Qt.Alignment</a> QFormLayout.formAlignment (<i>self</i>)</h3><h3 class="fn"><a name="getItemPosition" />(int <i>rowPtr</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>rolePtr</i>) QFormLayout.getItemPosition (<i>self</i>, int <i>index</i>)</h3><p>Retrieves the row and role (column) of the item at the specified
<i>index</i>. If <i>index</i> is out of bounds, *<i>rowPtr</i> is
set to -1; otherwise the row is stored in *<i>rowPtr</i> and the
role is stored in *<i>rolePtr</i>.</p>
<p><b>See also</b> <a href="qformlayout.html#itemAt">itemAt</a>(),
<a href="qformlayout.html#count">count</a>(), <a href="qformlayout.html#getLayoutPosition">getLayoutPosition</a>(), and
<a href="qformlayout.html#getWidgetPosition">getWidgetPosition</a>().</p>
<h3 class="fn"><a name="getLayoutPosition" />(int <i>rowPtr</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>rolePtr</i>) QFormLayout.getLayoutPosition (<i>self</i>, <a href="qlayout.html">QLayout</a> <i>layout</i>)</h3><p>Retrieves the row and role (column) of the specified child
<i>layout</i>. If <i>layout</i> is not in the form layout,
*<i>rowPtr</i> is set to -1; otherwise the row is stored in
*<i>rowPtr</i> and the role is stored in *<i>rolePtr</i>.</p>
<h3 class="fn"><a name="getWidgetPosition" />(int <i>rowPtr</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>rolePtr</i>) QFormLayout.getWidgetPosition (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>Retrieves the row and role (column) of the specified
<i>widget</i> in the layout. If <i>widget</i> is not in the layout,
*<i>rowPtr</i> is set to -1; otherwise the row is stored in
*<i>rowPtr</i> and the role is stored in *<i>rolePtr</i>.</p>
<p><b>See also</b> <a href="qformlayout.html#getItemPosition">getItemPosition</a>() and
<a href="qformlayout.html#itemAt">itemAt</a>().</p>
<h3 class="fn"><a name="hasHeightForWidth" />bool QFormLayout.hasHeightForWidth (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem.hasHeightForWidth</a>().</p>
<h3 class="fn"><a name="heightForWidth" />int QFormLayout.heightForWidth (<i>self</i>, int <i>width</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem.heightForWidth</a>().</p>
<h3 class="fn"><a name="horizontalSpacing" />int QFormLayout.horizontalSpacing (<i>self</i>)</h3><h3 class="fn"><a name="insertRow" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, <a href="qwidget.html">QWidget</a> <i>label</i>, <a href="qwidget.html">QWidget</a> <i>field</i>)</h3><p>The <i>label</i> argument has it's ownership transferred to Qt.</p><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>Inserts a new row at position <i>row</i> in this form layout,
with the given <i>label</i> and <i>field</i>. If <i>row</i> is out
of bounds, the new row is added at the end.</p>
<p><b>See also</b> <a href="qformlayout.html#addRow">addRow</a>().</p>
<h3 class="fn"><a name="insertRow-2" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, <a href="qwidget.html">QWidget</a> <i>label</i>, <a href="qlayout.html">QLayout</a> <i>field</i>)</h3><p>The <i>label</i> argument has it's ownership transferred to Qt.</p><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<h3 class="fn"><a name="insertRow-3" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, QString <i>labelText</i>, <a href="qwidget.html">QWidget</a> <i>field</i>)</h3><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>This overload automatically creates a <a href="qlabel.html">QLabel</a> behind the scenes with <i>labelText</i> as
its text. The <i>field</i> is set as the new <a href="qlabel.html">QLabel</a>'s <a href="qlabel.html#setBuddy">buddy</a>.</p>
<h3 class="fn"><a name="insertRow-4" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, QString <i>labelText</i>, <a href="qlayout.html">QLayout</a> <i>field</i>)</h3><p>The <i>field</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>This overload automatically creates a <a href="qlabel.html">QLabel</a> behind the scenes with <i>labelText</i> as
its text.</p>
<h3 class="fn"><a name="insertRow-5" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>Inserts the specified <i>widget</i> at position <i>row</i> in
this form layout. The <i>widget</i> spans both columns. If
<i>row</i> is out of bounds, the widget is added at the end.</p>
<h3 class="fn"><a name="insertRow-6" />QFormLayout.insertRow (<i>self</i>, int <i>row</i>, <a href="qlayout.html">QLayout</a> <i>layout</i>)</h3><p>The <i>layout</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>Inserts the specified <i>layout</i> at position <i>row</i> in
this form layout. The <i>layout</i> spans both columns. If
<i>row</i> is out of bounds, the widget is added at the end.</p>
<h3 class="fn"><a name="invalidate" />QFormLayout.invalidate (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#invalidate">QLayoutItem.invalidate</a>().</p>
<h3 class="fn"><a name="itemAt" /><a href="qlayoutitem.html">QLayoutItem</a> QFormLayout.itemAt (<i>self</i>, int <i>row</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>role</i>)</h3><p>Returns the layout item in the given <i>row</i> with the
specified <i>role</i> (column). Returns 0 if there is no such
item.</p>
<p><b>See also</b> <a href="qlayout.html#itemAt">QLayout.itemAt</a>() and <a href="qformlayout.html#setItem">setItem</a>().</p>
<h3 class="fn"><a name="itemAt-2" /><a href="qlayoutitem.html">QLayoutItem</a> QFormLayout.itemAt (<i>self</i>, int <i>index</i>)</h3><p>Reimplemented from <a href="qlayout.html#itemAt">QLayout.itemAt</a>().</p>
<h3 class="fn"><a name="labelAlignment" /><a href="qt-alignment.html">Qt.Alignment</a> QFormLayout.labelAlignment (<i>self</i>)</h3><h3 class="fn"><a name="labelForField" /><a href="qwidget.html">QWidget</a> QFormLayout.labelForField (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>field</i>)</h3><p>Returns the label associated with the given <i>field</i>.</p>
<p><b>See also</b> <a href="qformlayout.html#itemAt">itemAt</a>().</p>
<h3 class="fn"><a name="labelForField-2" /><a href="qwidget.html">QWidget</a> QFormLayout.labelForField (<i>self</i>, <a href="qlayout.html">QLayout</a> <i>field</i>)</h3><p>This is an overloaded function.</p>
<h3 class="fn"><a name="minimumSize" /><a href="qsize.html">QSize</a> QFormLayout.minimumSize (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem.minimumSize</a>().</p>
<h3 class="fn"><a name="rowCount" />int QFormLayout.rowCount (<i>self</i>)</h3><p>Returns the number of rows in the form.</p>
<p><b>See also</b> <a href="qlayout.html#count">QLayout.count</a>().</p>
<h3 class="fn"><a name="rowWrapPolicy" /><a href="qformlayout.html#RowWrapPolicy-enum">RowWrapPolicy</a> QFormLayout.rowWrapPolicy (<i>self</i>)</h3><h3 class="fn"><a name="setFieldGrowthPolicy" />QFormLayout.setFieldGrowthPolicy (<i>self</i>, <a href="qformlayout.html#FieldGrowthPolicy-enum">FieldGrowthPolicy</a> <i>policy</i>)</h3><h3 class="fn"><a name="setFormAlignment" />QFormLayout.setFormAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>alignment</i>)</h3><h3 class="fn"><a name="setGeometry" />QFormLayout.setGeometry (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem.setGeometry</a>().</p>
<h3 class="fn"><a name="setHorizontalSpacing" />QFormLayout.setHorizontalSpacing (<i>self</i>, int <i>spacing</i>)</h3><h3 class="fn"><a name="setItem" />QFormLayout.setItem (<i>self</i>, int <i>row</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>role</i>, <a href="qlayoutitem.html">QLayoutItem</a> <i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Sets the item in the given <i>row</i> for the given <i>role</i>
to <i>item</i>, extending the layout with empty rows if
necessary.</p>
<p>If the cell is already occupied, the <i>item</i> is not inserted
and an error message is sent to the console. The <i>item</i> spans
both columns.</p>
<p><b>Warning:</b> Do not use this function to add child layouts or
child widget items. Use <a href="qformlayout.html#setLayout">setLayout</a>() or <a href="qformlayout.html#setWidget">setWidget</a>() instead.</p>
<p><b>See also</b> <a href="qformlayout.html#setLayout">setLayout</a>().</p>
<h3 class="fn"><a name="setLabelAlignment" />QFormLayout.setLabelAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>alignment</i>)</h3><h3 class="fn"><a name="setLayout" />QFormLayout.setLayout (<i>self</i>, int <i>row</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>role</i>, <a href="qlayout.html">QLayout</a> <i>layout</i>)</h3><p>The <i>layout</i> argument has it's ownership transferred to Qt.</p><p>Sets the sub-layout in the given <i>row</i> for the given
<i>role</i> to <i>layout</i>, extending the form layout with empty
rows if necessary.</p>
<p>If the cell is already occupied, the <i>layout</i> is not
inserted and an error message is sent to the console.</p>
<p><b>Note:</b> For most applications, <a href="qformlayout.html#addRow">addRow</a>() or <a href="qformlayout.html#insertRow">insertRow</a>() should be used instead
of setLayout().</p>
<p><b>See also</b> <a href="qformlayout.html#setWidget">setWidget</a>().</p>
<h3 class="fn"><a name="setRowWrapPolicy" />QFormLayout.setRowWrapPolicy (<i>self</i>, <a href="qformlayout.html#RowWrapPolicy-enum">RowWrapPolicy</a> <i>policy</i>)</h3><h3 class="fn"><a name="setSpacing" />QFormLayout.setSpacing (<i>self</i>, int)</h3><p>This function sets both the vertical and horizontal spacing to
<i>spacing</i>.</p>
<p><b>See also</b> <a href="qformlayout.html#spacing">spacing</a>(), <a href="qformlayout.html#verticalSpacing-prop">setVerticalSpacing</a>(),
and <a href="qformlayout.html#horizontalSpacing-prop">setHorizontalSpacing</a>().</p>
<h3 class="fn"><a name="setVerticalSpacing" />QFormLayout.setVerticalSpacing (<i>self</i>, int <i>spacing</i>)</h3><h3 class="fn"><a name="setWidget" />QFormLayout.setWidget (<i>self</i>, int <i>row</i>, <a href="qformlayout.html#ItemRole-enum">ItemRole</a> <i>role</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Sets the widget in the given <i>row</i> for the given
<i>role</i> to <i>widget</i>, extending the layout with empty rows
if necessary.</p>
<p>If the cell is already occupied, the <i>widget</i> is not
inserted and an error message is sent to the console.</p>
<p><b>Note:</b> For most applications, <a href="qformlayout.html#addRow">addRow</a>() or <a href="qformlayout.html#insertRow">insertRow</a>() should be used instead
of setWidget().</p>
<p><b>See also</b> <a href="qformlayout.html#setLayout">setLayout</a>().</p>
<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QFormLayout.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem.sizeHint</a>().</p>
<h3 class="fn"><a name="spacing" />int QFormLayout.spacing (<i>self</i>)</h3><p>If the vertical spacing is equal to the horizontal spacing, this
function returns that value; otherwise it returns -1.</p>
<p><b>See also</b> <a href="qformlayout.html#setSpacing">setSpacing</a>(), <a href="qformlayout.html#verticalSpacing-prop">verticalSpacing</a>(), and
<a href="qformlayout.html#horizontalSpacing-prop">horizontalSpacing</a>().</p>
<h3 class="fn"><a name="takeAt" /><a href="qlayoutitem.html">QLayoutItem</a> QFormLayout.takeAt (<i>self</i>, int <i>index</i>)</h3><p>The <i>QLayoutItem</i> result</p><p>Reimplemented from <a href="qlayout.html#takeAt">QLayout.takeAt</a>().</p>
<h3 class="fn"><a name="verticalSpacing" />int QFormLayout.verticalSpacing (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.11.2 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://qt.digia.com">Digia</a> 2014</td><td align="right" width="25%">Qt 4.8.6</td></tr></table></div></address></body></html>
|