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 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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" />
<!-- qformlayout.cpp -->
<title>Qt 4.8: QFormLayout Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QFormLayout</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QFormLayout Class Reference</h1>
<!-- $$$QFormLayout-brief -->
<p>The QFormLayout class manages forms of input widgets and their associated labels. <a href="#details">More...</a></p>
<!-- @@@QFormLayout -->
<pre class="cpp"> <span class="preprocessor">#include <QFormLayout></span></pre><p><b>Inherits: </b><a href="qlayout.html">QLayout</a>.</p>
<p>This class was introduced in Qt 4.4.</p>
<ul>
<li><a href="qformlayout-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#FieldGrowthPolicy-enum">FieldGrowthPolicy</a></b> { FieldsStayAtSizeHint, ExpandingFieldsGrow, AllNonFixedFieldsGrow }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#ItemRole-enum">ItemRole</a></b> { LabelRole, FieldRole, SpanningRole }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#RowWrapPolicy-enum">RowWrapPolicy</a></b> { DontWrapRows, WrapLongRows, WrapAllRows }</td></tr>
</table>
<a name="properties"></a>
<h2>Properties</h2>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qformlayout.html#fieldGrowthPolicy-prop">fieldGrowthPolicy</a></b> : FieldGrowthPolicy</li>
<li class="fn"><b><a href="qformlayout.html#formAlignment-prop">formAlignment</a></b> : Qt::Alignment</li>
<li class="fn"><b><a href="qformlayout.html#horizontalSpacing-prop">horizontalSpacing</a></b> : int</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qformlayout.html#labelAlignment-prop">labelAlignment</a></b> : Qt::Alignment</li>
<li class="fn"><b><a href="qformlayout.html#rowWrapPolicy-prop">rowWrapPolicy</a></b> : RowWrapPolicy</li>
<li class="fn"><b><a href="qformlayout.html#verticalSpacing-prop">verticalSpacing</a></b> : int</li>
</ul>
</td></tr>
</table>
<ul>
<li class="fn">2 properties inherited from <a href="qlayout.html#properties">QLayout</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#QFormLayout">QFormLayout</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#dtor.QFormLayout">~QFormLayout</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow">addRow</a></b> ( QWidget * <i>label</i>, QWidget * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow-2">addRow</a></b> ( QWidget * <i>label</i>, QLayout * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow-3">addRow</a></b> ( const QString & <i>labelText</i>, QWidget * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow-4">addRow</a></b> ( const QString & <i>labelText</i>, QLayout * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow-5">addRow</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addRow-6">addRow</a></b> ( QLayout * <i>layout</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> FieldGrowthPolicy </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#fieldGrowthPolicy-prop">fieldGrowthPolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#formAlignment-prop">formAlignment</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#getItemPosition">getItemPosition</a></b> ( int <i>index</i>, int * <i>rowPtr</i>, ItemRole * <i>rolePtr</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#getLayoutPosition">getLayoutPosition</a></b> ( QLayout * <i>layout</i>, int * <i>rowPtr</i>, ItemRole * <i>rolePtr</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#getWidgetPosition">getWidgetPosition</a></b> ( QWidget * <i>widget</i>, int * <i>rowPtr</i>, ItemRole * <i>rolePtr</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#horizontalSpacing-prop">horizontalSpacing</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow">insertRow</a></b> ( int <i>row</i>, QWidget * <i>label</i>, QWidget * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow-2">insertRow</a></b> ( int <i>row</i>, QWidget * <i>label</i>, QLayout * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow-3">insertRow</a></b> ( int <i>row</i>, const QString & <i>labelText</i>, QWidget * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow-4">insertRow</a></b> ( int <i>row</i>, const QString & <i>labelText</i>, QLayout * <i>field</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow-5">insertRow</a></b> ( int <i>row</i>, QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#insertRow-6">insertRow</a></b> ( int <i>row</i>, QLayout * <i>layout</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLayoutItem * </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#itemAt">itemAt</a></b> ( int <i>row</i>, ItemRole <i>role</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#labelAlignment-prop">labelAlignment</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#labelForField">labelForField</a></b> ( QWidget * <i>field</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#labelForField-2">labelForField</a></b> ( QLayout * <i>field</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#rowCount">rowCount</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> RowWrapPolicy </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#rowWrapPolicy-prop">rowWrapPolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#fieldGrowthPolicy-prop">setFieldGrowthPolicy</a></b> ( FieldGrowthPolicy <i>policy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#formAlignment-prop">setFormAlignment</a></b> ( Qt::Alignment <i>alignment</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#horizontalSpacing-prop">setHorizontalSpacing</a></b> ( int <i>spacing</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#setItem">setItem</a></b> ( int <i>row</i>, ItemRole <i>role</i>, QLayoutItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#labelAlignment-prop">setLabelAlignment</a></b> ( Qt::Alignment <i>alignment</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#setLayout">setLayout</a></b> ( int <i>row</i>, ItemRole <i>role</i>, QLayout * <i>layout</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#rowWrapPolicy-prop">setRowWrapPolicy</a></b> ( RowWrapPolicy <i>policy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#setSpacing">setSpacing</a></b> ( int <i>spacing</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#verticalSpacing-prop">setVerticalSpacing</a></b> ( int <i>spacing</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#setWidget">setWidget</a></b> ( int <i>row</i>, ItemRole <i>role</i>, QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#spacing">spacing</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#verticalSpacing-prop">verticalSpacing</a></b> () const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#addItem">addItem</a></b> ( QLayoutItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#count">count</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::Orientations </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#expandingDirections">expandingDirections</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#hasHeightForWidth">hasHeightForWidth</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#heightForWidth">heightForWidth</a></b> ( int <i>width</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#invalidate">invalidate</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QLayoutItem * </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#itemAt-2">itemAt</a></b> ( int <i>index</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#minimumSize">minimumSize</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#setGeometry">setGeometry</a></b> ( const QRect & <i>rect</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#sizeHint">sizeHint</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QLayoutItem * </td><td class="memItemRight bottomAlign"><b><a href="qformlayout.html#takeAt">takeAt</a></b> ( int <i>index</i> )</td></tr>
</table>
<ul>
<li class="fn">35 public functions inherited from <a href="qlayout.html#public-functions">QLayout</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">17 public functions inherited from <a href="qlayoutitem.html#public-functions">QLayoutItem</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">1 static public member inherited from <a href="qlayout.html#static-public-members">QLayout</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">4 protected functions inherited from <a href="qlayout.html#protected-functions">QLayout</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QFormLayout-description -->
<div class="descr">
<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 valign="top" class="odd"><td ><img src="images/qformlayout-win.png" alt="" /></td><td ><img src="images/qformlayout-mac.png" alt="" /></td><td ><img src="images/qformlayout-kde.png" alt="" /></td><td ><img src="images/qformlayout-qpe.png" alt="" /></td></tr>
<tr valign="top" class="even"><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>
</div>
<p><b>See also </b><a href="qgridlayout.html">QGridLayout</a>, <a href="qboxlayout.html">QBoxLayout</a>, and <a href="qstackedlayout.html">QStackedLayout</a>.</p>
<!-- @@@QFormLayout -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$FieldGrowthPolicy$$$FieldsStayAtSizeHint$$$ExpandingFieldsGrow$$$AllNonFixedFieldsGrow -->
<h3 class="fn"><a name="FieldGrowthPolicy-enum"></a>enum QFormLayout::<span class="name">FieldGrowthPolicy</span></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 valign="top" class="odd"><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>
<!-- @@@FieldGrowthPolicy -->
<!-- $$$ItemRole$$$LabelRole$$$FieldRole$$$SpanningRole -->
<h3 class="fn"><a name="ItemRole-enum"></a>enum QFormLayout::<span class="name">ItemRole</span></h3>
<p>This enum specifies the types of widgets (or other layout items) that may appear in a row.</p>
<table class="valuelist"><tr valign="top" class="odd"><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>
<!-- @@@ItemRole -->
<!-- $$$RowWrapPolicy$$$DontWrapRows$$$WrapLongRows$$$WrapAllRows -->
<h3 class="fn"><a name="RowWrapPolicy-enum"></a>enum QFormLayout::<span class="name">RowWrapPolicy</span></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 valign="top" class="odd"><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>
<!-- @@@RowWrapPolicy -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$fieldGrowthPolicy-prop$$$fieldGrowthPolicy$$$setFieldGrowthPolicyFieldGrowthPolicy -->
<h3 class="fn"><a name="fieldGrowthPolicy-prop"></a><span class="name">fieldGrowthPolicy</span> : <span class="type"><a href="qformlayout.html#FieldGrowthPolicy-enum">FieldGrowthPolicy</a></span></h3>
<p>This property holds the way in which the form's fields grow.</p>
<p>The default value depends on the widget or application style. For <a href="qmacstyle.html">QMacStyle</a>, the default is <a href="qformlayout.html#FieldGrowthPolicy-enum">FieldsStayAtSizeHint</a>; for <a href="qcommonstyle.html">QCommonStyle</a> derived styles (like Plastique and Windows), the default is <a href="qformlayout.html#FieldGrowthPolicy-enum">ExpandingFieldsGrow</a>; for Qt Extended styles, the default is <a href="qformlayout.html#FieldGrowthPolicy-enum">AllNonFixedFieldsGrow</a>.</p>
<p>If none of the fields can grow and the form is resized, extra space is distributed according to the current <a href="qformlayout.html#formAlignment-prop">form alignment</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> FieldGrowthPolicy </td><td class="memItemRight bottomAlign"><span class="name"><b>fieldGrowthPolicy</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setFieldGrowthPolicy</b></span> ( FieldGrowthPolicy <i>policy</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#formAlignment-prop">formAlignment</a> and <a href="qformlayout.html#rowWrapPolicy-prop">rowWrapPolicy</a>.</p>
<!-- @@@fieldGrowthPolicy -->
<!-- $$$formAlignment-prop$$$formAlignment$$$setFormAlignmentQt::Alignment -->
<h3 class="fn"><a name="formAlignment-prop"></a><span class="name">formAlignment</span> : <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span></h3>
<p>This property holds the alignment of the form layout's contents within the layout's geometry.</p>
<p>The default value depends on the widget or application style. For <a href="qmacstyle.html">QMacStyle</a>, the default is <a href="qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a> | <a href="qt.html#AlignmentFlag-enum">Qt::AlignTop</a>; for the other styles, the default is <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a> | <a href="qt.html#AlignmentFlag-enum">Qt::AlignTop</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><span class="name"><b>formAlignment</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setFormAlignment</b></span> ( Qt::Alignment <i>alignment</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#labelAlignment-prop">labelAlignment</a> and <a href="qformlayout.html#rowWrapPolicy-prop">rowWrapPolicy</a>.</p>
<!-- @@@formAlignment -->
<!-- $$$horizontalSpacing-prop$$$horizontalSpacing$$$setHorizontalSpacingint -->
<h3 class="fn"><a name="horizontalSpacing-prop"></a><span class="name">horizontalSpacing</span> : <span class="type">int</span></h3>
<p>This property holds the spacing between widgets that are laid out side by side.</p>
<p>By default, if no value is explicitly set, the layout's horizontal spacing is inherited from the parent layout, or from the style settings for the parent widget.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>horizontalSpacing</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setHorizontalSpacing</b></span> ( int <i>spacing</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#verticalSpacing-prop">verticalSpacing</a>, <a href="qstyle.html#pixelMetric">QStyle::pixelMetric</a>(), and <a href="qstyle.html#PixelMetric-enum">PM_LayoutHorizontalSpacing</a>.</p>
<!-- @@@horizontalSpacing -->
<!-- $$$labelAlignment-prop$$$labelAlignment$$$setLabelAlignmentQt::Alignment -->
<h3 class="fn"><a name="labelAlignment-prop"></a><span class="name">labelAlignment</span> : <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span></h3>
<p>This property holds the horizontal alignment of the labels.</p>
<p>The default value depends on the widget or application style. For <a href="qcommonstyle.html">QCommonStyle</a> derived styles, except for <a href="qplastiquestyle.html">QPlastiqueStyle</a>, the default is <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>; for the other styles, the default is <a href="qt.html#AlignmentFlag-enum">Qt::AlignRight</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><span class="name"><b>labelAlignment</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setLabelAlignment</b></span> ( Qt::Alignment <i>alignment</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#formAlignment-prop">formAlignment</a>.</p>
<!-- @@@labelAlignment -->
<!-- $$$rowWrapPolicy-prop$$$rowWrapPolicy$$$setRowWrapPolicyRowWrapPolicy -->
<h3 class="fn"><a name="rowWrapPolicy-prop"></a><span class="name">rowWrapPolicy</span> : <span class="type"><a href="qformlayout.html#RowWrapPolicy-enum">RowWrapPolicy</a></span></h3>
<p>This property holds the way in which the form's rows wrap.</p>
<p>The default value depends on the widget or application style. For Qt Extended styles and <a href="qs60style.html">QS60Style</a>, the default is <a href="qformlayout.html#RowWrapPolicy-enum">WrapLongRows</a>; for the other styles, the default is <a href="qformlayout.html#RowWrapPolicy-enum">DontWrapRows</a>.</p>
<p>If you want to display each label above its associated field (instead of next to it), set this property to <a href="qformlayout.html#RowWrapPolicy-enum">WrapAllRows</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> RowWrapPolicy </td><td class="memItemRight bottomAlign"><span class="name"><b>rowWrapPolicy</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setRowWrapPolicy</b></span> ( RowWrapPolicy <i>policy</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#fieldGrowthPolicy-prop">fieldGrowthPolicy</a>.</p>
<!-- @@@rowWrapPolicy -->
<!-- $$$verticalSpacing-prop$$$verticalSpacing$$$setVerticalSpacingint -->
<h3 class="fn"><a name="verticalSpacing-prop"></a><span class="name">verticalSpacing</span> : <span class="type">int</span></h3>
<p>This property holds the spacing between widgets that are laid out vertically.</p>
<p>By default, if no value is explicitly set, the layout's vertical spacing is inherited from the parent layout, or from the style settings for the parent widget.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>verticalSpacing</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setVerticalSpacing</b></span> ( int <i>spacing</i> )</td></tr>
</table>
<p><b>See also </b><a href="qformlayout.html#horizontalSpacing-prop">horizontalSpacing</a>, <a href="qstyle.html#pixelMetric">QStyle::pixelMetric</a>(), and <a href="qstyle.html#PixelMetric-enum">PM_LayoutHorizontalSpacing</a>.</p>
<!-- @@@verticalSpacing -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QFormLayout[overload1]$$$QFormLayoutQWidget* -->
<h3 class="fn"><a name="QFormLayout"></a>QFormLayout::<span class="name">QFormLayout</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<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>
<!-- @@@QFormLayout -->
<!-- $$$~QFormLayout[overload1]$$$~QFormLayout -->
<h3 class="fn"><a name="dtor.QFormLayout"></a>QFormLayout::<span class="name">~QFormLayout</span> ()</h3>
<p>Destroys the form layout.</p>
<!-- @@@~QFormLayout -->
<!-- $$$addItem[overload1]$$$addItemQLayoutItem* -->
<h3 class="fn"><a name="addItem"></a><span class="type">void</span> QFormLayout::<span class="name">addItem</span> ( <span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> * <i>item</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayout.html#addItem">QLayout::addItem</a>().</p>
<!-- @@@addItem -->
<!-- $$$addRow[overload1]$$$addRowQWidget*QWidget* -->
<h3 class="fn"><a name="addRow"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>label</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@addRow -->
<!-- $$$addRow$$$addRowQWidget*QLayout* -->
<h3 class="fn"><a name="addRow-2"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>label</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>field</i> )</h3>
<p>This is an overloaded function.</p>
<!-- @@@addRow -->
<!-- $$$addRow$$$addRowconstQString&QWidget* -->
<h3 class="fn"><a name="addRow-3"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>labelText</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@addRow -->
<!-- $$$addRow$$$addRowconstQString&QLayout* -->
<h3 class="fn"><a name="addRow-4"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>labelText</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@addRow -->
<!-- $$$addRow$$$addRowQWidget* -->
<h3 class="fn"><a name="addRow-5"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<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>
<!-- @@@addRow -->
<!-- $$$addRow$$$addRowQLayout* -->
<h3 class="fn"><a name="addRow-6"></a><span class="type">void</span> QFormLayout::<span class="name">addRow</span> ( <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>layout</i> )</h3>
<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>
<!-- @@@addRow -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type">int</span> QFormLayout::<span class="name">count</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayout.html#count">QLayout::count</a>().</p>
<!-- @@@count -->
<!-- $$$expandingDirections[overload1]$$$expandingDirections -->
<h3 class="fn"><a name="expandingDirections"></a><span class="type"><a href="qt.html#Orientation-enum">Qt::Orientations</a></span> QFormLayout::<span class="name">expandingDirections</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem::expandingDirections</a>().</p>
<!-- @@@expandingDirections -->
<!-- $$$getItemPosition[overload1]$$$getItemPositionintint*ItemRole* -->
<h3 class="fn"><a name="getItemPosition"></a><span class="type">void</span> QFormLayout::<span class="name">getItemPosition</span> ( <span class="type">int</span> <i>index</i>, <span class="type">int</span> * <i>rowPtr</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> * <i>rolePtr</i> ) const</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>
<!-- @@@getItemPosition -->
<!-- $$$getLayoutPosition[overload1]$$$getLayoutPositionQLayout*int*ItemRole* -->
<h3 class="fn"><a name="getLayoutPosition"></a><span class="type">void</span> QFormLayout::<span class="name">getLayoutPosition</span> ( <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>layout</i>, <span class="type">int</span> * <i>rowPtr</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> * <i>rolePtr</i> ) const</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>
<!-- @@@getLayoutPosition -->
<!-- $$$getWidgetPosition[overload1]$$$getWidgetPositionQWidget*int*ItemRole* -->
<h3 class="fn"><a name="getWidgetPosition"></a><span class="type">void</span> QFormLayout::<span class="name">getWidgetPosition</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i>, <span class="type">int</span> * <i>rowPtr</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> * <i>rolePtr</i> ) const</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>
<!-- @@@getWidgetPosition -->
<!-- $$$hasHeightForWidth[overload1]$$$hasHeightForWidth -->
<h3 class="fn"><a name="hasHeightForWidth"></a><span class="type">bool</span> QFormLayout::<span class="name">hasHeightForWidth</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem::hasHeightForWidth</a>().</p>
<!-- @@@hasHeightForWidth -->
<!-- $$$heightForWidth[overload1]$$$heightForWidthint -->
<h3 class="fn"><a name="heightForWidth"></a><span class="type">int</span> QFormLayout::<span class="name">heightForWidth</span> ( <span class="type">int</span> <i>width</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem::heightForWidth</a>().</p>
<!-- @@@heightForWidth -->
<!-- $$$insertRow[overload1]$$$insertRowintQWidget*QWidget* -->
<h3 class="fn"><a name="insertRow"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>label</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintQWidget*QLayout* -->
<h3 class="fn"><a name="insertRow-2"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>label</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>field</i> )</h3>
<p>This is an overloaded function.</p>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintconstQString&QWidget* -->
<h3 class="fn"><a name="insertRow-3"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>labelText</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintconstQString&QLayout* -->
<h3 class="fn"><a name="insertRow-4"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>labelText</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>field</i> )</h3>
<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>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintQWidget* -->
<h3 class="fn"><a name="insertRow-5"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<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>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintQLayout* -->
<h3 class="fn"><a name="insertRow-6"></a><span class="type">void</span> QFormLayout::<span class="name">insertRow</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>layout</i> )</h3>
<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>
<!-- @@@insertRow -->
<!-- $$$invalidate[overload1]$$$invalidate -->
<h3 class="fn"><a name="invalidate"></a><span class="type">void</span> QFormLayout::<span class="name">invalidate</span> ()<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#invalidate">QLayoutItem::invalidate</a>().</p>
<!-- @@@invalidate -->
<!-- $$$itemAt[overload1]$$$itemAtintItemRole -->
<h3 class="fn"><a name="itemAt"></a><span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> * QFormLayout::<span class="name">itemAt</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> <i>role</i> ) const</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>
<!-- @@@itemAt -->
<!-- $$$itemAt$$$itemAtint -->
<h3 class="fn"><a name="itemAt-2"></a><span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> * QFormLayout::<span class="name">itemAt</span> ( <span class="type">int</span> <i>index</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayout.html#itemAt">QLayout::itemAt</a>().</p>
<!-- @@@itemAt -->
<!-- $$$labelForField[overload1]$$$labelForFieldQWidget* -->
<h3 class="fn"><a name="labelForField"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QFormLayout::<span class="name">labelForField</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>field</i> ) const</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>
<!-- @@@labelForField -->
<!-- $$$labelForField$$$labelForFieldQLayout* -->
<h3 class="fn"><a name="labelForField-2"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QFormLayout::<span class="name">labelForField</span> ( <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>field</i> ) const</h3>
<p>This is an overloaded function.</p>
<!-- @@@labelForField -->
<!-- $$$minimumSize[overload1]$$$minimumSize -->
<h3 class="fn"><a name="minimumSize"></a><span class="type"><a href="qsize.html">QSize</a></span> QFormLayout::<span class="name">minimumSize</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem::minimumSize</a>().</p>
<!-- @@@minimumSize -->
<!-- $$$rowCount[overload1]$$$rowCount -->
<h3 class="fn"><a name="rowCount"></a><span class="type">int</span> QFormLayout::<span class="name">rowCount</span> () const</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>
<!-- @@@rowCount -->
<!-- $$$setGeometry[overload1]$$$setGeometryconstQRect& -->
<h3 class="fn"><a name="setGeometry"></a><span class="type">void</span> QFormLayout::<span class="name">setGeometry</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> & <i>rect</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem::setGeometry</a>().</p>
<!-- @@@setGeometry -->
<!-- $$$setItem[overload1]$$$setItemintItemRoleQLayoutItem* -->
<h3 class="fn"><a name="setItem"></a><span class="type">void</span> QFormLayout::<span class="name">setItem</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> <i>role</i>, <span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> * <i>item</i> )</h3>
<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>
<!-- @@@setItem -->
<!-- $$$setLayout[overload1]$$$setLayoutintItemRoleQLayout* -->
<h3 class="fn"><a name="setLayout"></a><span class="type">void</span> QFormLayout::<span class="name">setLayout</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> <i>role</i>, <span class="type"><a href="qlayout.html">QLayout</a></span> * <i>layout</i> )</h3>
<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>
<!-- @@@setLayout -->
<!-- $$$setSpacing[overload1]$$$setSpacingint -->
<h3 class="fn"><a name="setSpacing"></a><span class="type">void</span> QFormLayout::<span class="name">setSpacing</span> ( <span class="type">int</span> <i>spacing</i> )</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>
<!-- @@@setSpacing -->
<!-- $$$setWidget[overload1]$$$setWidgetintItemRoleQWidget* -->
<h3 class="fn"><a name="setWidget"></a><span class="type">void</span> QFormLayout::<span class="name">setWidget</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qformlayout.html#ItemRole-enum">ItemRole</a></span> <i>role</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<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>
<!-- @@@setWidget -->
<!-- $$$sizeHint[overload1]$$$sizeHint -->
<h3 class="fn"><a name="sizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QFormLayout::<span class="name">sizeHint</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem::sizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$spacing[overload1]$$$spacing -->
<h3 class="fn"><a name="spacing"></a><span class="type">int</span> QFormLayout::<span class="name">spacing</span> () const</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>
<!-- @@@spacing -->
<!-- $$$takeAt[overload1]$$$takeAtint -->
<h3 class="fn"><a name="takeAt"></a><span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> * QFormLayout::<span class="name">takeAt</span> ( <span class="type">int</span> <i>index</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qlayout.html#takeAt">QLayout::takeAt</a>().</p>
<!-- @@@takeAt -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
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.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|