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
|
<?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>QLayout 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">QLayout Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QLayout class is the base class of geometry managers.
<a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a> and <a href="qlayoutitem.html">QLayoutItem</a>.</p><p>Inherited by <a href="qboxlayout.html">QBoxLayout</a>, <a href="qformlayout.html">QFormLayout</a>, <a href="qgridlayout.html">QGridLayout</a> and <a href="qstackedlayout.html">QStackedLayout</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a></b> { SetDefaultConstraint, SetNoConstraint, SetMinimumSize, SetFixedSize, SetMaximumSize, SetMinAndMaxSize }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlayout.html#QLayout">__init__</a></b> (<i>self</i>, QWidget <i>parent</i>)</li><li><div class="fn" /><b><a href="qlayout.html#QLayout-2">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlayout.html#activate">activate</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlayout.html#addChildLayout">addChildLayout</a></b> (<i>self</i>, QLayout <i>l</i>)</li><li><div class="fn" /><b><a href="qlayout.html#addChildWidget">addChildWidget</a></b> (<i>self</i>, QWidget <i>w</i>)</li><li><div class="fn" /><b><a href="qlayout.html#addItem">addItem</a></b> (<i>self</i>, QLayoutItem)</li><li><div class="fn" /><b><a href="qlayout.html#addWidget">addWidget</a></b> (<i>self</i>, QWidget <i>w</i>)</li><li><div class="fn" />QRect <b><a href="qlayout.html#alignmentRect">alignmentRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qlayout.html#childEvent">childEvent</a></b> (<i>self</i>, QChildEvent <i>e</i>)</li><li><div class="fn" />QMargins <b><a href="qlayout.html#contentsMargins">contentsMargins</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qlayout.html#contentsRect">contentsRect</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayout.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Orientations <b><a href="qlayout.html#expandingDirections">expandingDirections</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qlayout.html#geometry">geometry</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>left</i>, int <i>top</i>, int <i>right</i>, int <i>bottom</i>) <b><a href="qlayout.html#getContentsMargins">getContentsMargins</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayout.html#indexOf">indexOf</a></b> (<i>self</i>, QWidget)</li><li><div class="fn" /><b><a href="qlayout.html#invalidate">invalidate</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlayout.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlayout.html#isEnabled">isEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qlayout.html#itemAt">itemAt</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />QLayout <b><a href="qlayout.html#layout">layout</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayout.html#margin">margin</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlayout.html#maximumSize">maximumSize</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qlayout.html#menuBar">menuBar</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlayout.html#minimumSize">minimumSize</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qlayout.html#parentWidget">parentWidget</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlayout.html#removeItem">removeItem</a></b> (<i>self</i>, QLayoutItem)</li><li><div class="fn" /><b><a href="qlayout.html#removeWidget">removeWidget</a></b> (<i>self</i>, QWidget <i>w</i>)</li><li><div class="fn" />bool <b><a href="qlayout.html#setAlignment">setAlignment</a></b> (<i>self</i>, QWidget <i>w</i>, Qt.Alignment <i>alignment</i>)</li><li><div class="fn" />bool <b><a href="qlayout.html#setAlignment-2">setAlignment</a></b> (<i>self</i>, QLayout <i>l</i>, Qt.Alignment <i>alignment</i>)</li><li><div class="fn" /><b><a href="qlayout.html#setAlignment-3">setAlignment</a></b> (<i>self</i>, Qt.Alignment <i>alignment</i>)</li><li><div class="fn" /><b><a href="qlayout.html#setContentsMargins">setContentsMargins</a></b> (<i>self</i>, int <i>left</i>, int <i>top</i>, int <i>right</i>, int <i>bottom</i>)</li><li><div class="fn" /><b><a href="qlayout.html#setContentsMargins-2">setContentsMargins</a></b> (<i>self</i>, QMargins <i>margins</i>)</li><li><div class="fn" /><b><a href="qlayout.html#setEnabled">setEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qlayout.html#setGeometry">setGeometry</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qlayout.html#setMargin">setMargin</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qlayout.html#setMenuBar">setMenuBar</a></b> (<i>self</i>, QWidget <i>w</i>)</li><li><div class="fn" /><b><a href="qlayout.html#setSizeConstraint">setSizeConstraint</a></b> (<i>self</i>, SizeConstraint)</li><li><div class="fn" /><b><a href="qlayout.html#setSpacing">setSpacing</a></b> (<i>self</i>, int)</li><li><div class="fn" />SizeConstraint <b><a href="qlayout.html#sizeConstraint">sizeConstraint</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayout.html#spacing">spacing</a></b> (<i>self</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qlayout.html#takeAt">takeAt</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />int <b><a href="qlayout.html#totalHeightForWidth">totalHeightForWidth</a></b> (<i>self</i>, int <i>w</i>)</li><li><div class="fn" />QSize <b><a href="qlayout.html#totalMaximumSize">totalMaximumSize</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlayout.html#totalMinimumSize">totalMinimumSize</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlayout.html#totalSizeHint">totalSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlayout.html#update">update</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlayout.html#widgetEvent">widgetEvent</a></b> (<i>self</i>, QEvent)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QSize <b><a href="qlayout.html#closestAcceptableSize">closestAcceptableSize</a></b> (QWidget <i>w</i>, QSize <i>s</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" /> <b><a href="qlayout.html#__len__">__len__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLayout class is the base class of geometry managers.</p>
<p>This is an abstract base class inherited by the concrete classes
<a href="qboxlayout.html">QBoxLayout</a>, <a href="qgridlayout.html">QGridLayout</a>, <a href="qformlayout.html">QFormLayout</a>, and <a href="qstackedlayout.html">QStackedLayout</a>.</p>
<p>For users of QLayout subclasses or of <a href="qmainwindow.html">QMainWindow</a> there is seldom any need to use
the basic functions provided by QLayout, such as <a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a>() or
<a href="qlayout.html#setMenuBar">setMenuBar</a>(). See <a href="layout.html">Layout Management</a> for more information.</p>
<p>To make your own layout manager, implement the functions
<a href="qlayout.html#addItem">addItem</a>(), <a href="qlayoutitem.html#sizeHint">sizeHint</a>(), <a href="qlayout.html#setGeometry">setGeometry</a>(), <a href="qlayout.html#itemAt">itemAt</a>() and <a href="qlayout.html#takeAt">takeAt</a>(). You should also implement
<a href="qlayout.html#minimumSize">minimumSize</a>() to ensure your
layout isn't resized to zero size if there is too little space. To
support children whose heights depend on their widths, implement
<a href="qlayoutitem.html#hasHeightForWidth">hasHeightForWidth</a>() and
<a href="qlayoutitem.html#heightForWidth">heightForWidth</a>(). See
the <a href="layouts-borderlayout.html">Border Layout</a> and
<a href="layouts-flowlayout.html">Flow Layout</a> examples for more
information about implementing custom layout managers.</p>
<p>Geometry management stops when the layout manager is
deleted.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="SizeConstraint-enum" />QLayout.SizeConstraint</h3><p>The possible values are:</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>QLayout.SetDefaultConstraint</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The main widget's minimum size is set to
<a href="qlayout.html#minimumSize">minimumSize</a>(), unless the
widget already has a minimum size.</td>
</tr>
<tr>
<td class="topAlign"><tt>QLayout.SetFixedSize</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The main widget's size is set to <a href="qlayoutitem.html#sizeHint">sizeHint</a>(); it cannot be resized at
all.</td>
</tr>
<tr>
<td class="topAlign"><tt>QLayout.SetMinimumSize</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The main widget's minimum size is set to
<a href="qlayout.html#minimumSize">minimumSize</a>(); it cannot be
smaller.</td>
</tr>
<tr>
<td class="topAlign"><tt>QLayout.SetMaximumSize</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The main widget's maximum size is set to
<a href="qlayout.html#maximumSize">maximumSize</a>(); it cannot be
larger.</td>
</tr>
<tr>
<td class="topAlign"><tt>QLayout.SetMinAndMaxSize</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The main widget's minimum size is set to
<a href="qlayout.html#minimumSize">minimumSize</a>() and its
maximum size is set to <a href="qlayout.html#maximumSize">maximumSize</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QLayout.SetNoConstraint</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The widget is not constrained.</td>
</tr>
</table>
<p><b>See also</b> <a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLayout" />QLayout.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i>)</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 top-level <a href="qlayout.html">QLayout</a>,
with parent <i>parent</i>. <i>parent</i> may not be 0.</p>
<p>There can be only one top-level layout for a widget. It is
returned by <a href="qwidget.html#layout">QWidget.layout</a>().</p>
<h3 class="fn"><a name="QLayout-2" />QLayout.__init__ (<i>self</i>)</h3><p>Constructs a new child <a href="qlayout.html">QLayout</a>.</p>
<p>This layout has to be inserted into another layout before
geometry management will work.</p>
<h3 class="fn"><a name="activate" />bool QLayout.activate (<i>self</i>)</h3><p>Redoes the layout for <a href="qlayout.html#parentWidget">parentWidget</a>() if necessary.</p>
<p>You should generally not need to call this because it is
automatically called at the most appropriate times. It returns true
if the layout was redone.</p>
<p><b>See also</b> <a href="qlayout.html#update">update</a>() and
<a href="qwidget.html#updateGeometry">QWidget.updateGeometry</a>().</p>
<h3 class="fn"><a name="addChildLayout" />QLayout.addChildLayout (<i>self</i>, <a href="qlayout.html">QLayout</a> <i>l</i>)</h3><p>The <i>l</i> argument has it's ownership transferred to Qt.</p><p>This function is called from <tt>addLayout()</tt> or
<tt>insertLayout()</tt> functions in subclasses to add layout
<i>l</i> as a sub-layout.</p>
<p>The only scenario in which you need to call it directly is if
you implement a custom layout that supports nested layouts.</p>
<p><b>See also</b> <a href="qboxlayout.html#addLayout">QBoxLayout.addLayout</a>(), <a href="qboxlayout.html#insertLayout">QBoxLayout.insertLayout</a>(), and
<a href="qgridlayout.html#addLayout">QGridLayout.addLayout</a>().</p>
<h3 class="fn"><a name="addChildWidget" />QLayout.addChildWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>w</i>)</h3><p>The <i>w</i> argument has it's ownership transferred to Qt.</p><p>This function is called from <tt>addWidget()</tt> functions in
subclasses to add <i>w</i> as a managed widget of a layout.</p>
<p>If <i>w</i> is already managed by a layout, this function will
give a warning and remove <i>w</i> from that layout. This function
must therefore be called before adding <i>w</i> to the layout's
data structure.</p>
<h3 class="fn"><a name="addItem" />QLayout.addItem (<i>self</i>, <a href="qlayoutitem.html">QLayoutItem</a>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>The <i>QLayoutItem</i> argument has it's ownership transferred to Qt.</p><p>Implemented in subclasses to add an <i>item</i>. How it is added
is specific to each subclass.</p>
<p>This function is not usually called in application code. To add
a widget to a layout, use the <a href="qlayout.html#addWidget">addWidget</a>() function; to add a child
layout, use the addLayout() function provided by the relevant
<a href="qlayout.html">QLayout</a> subclass.</p>
<p><b>Note:</b> The ownership of <i>item</i> is transferred to the
layout, and it's the layout's responsibility to delete it.</p>
<p><b>See also</b> <a href="qlayout.html#addWidget">addWidget</a>(), <a href="qboxlayout.html#addLayout">QBoxLayout.addLayout</a>(), and
<a href="qgridlayout.html#addLayout">QGridLayout.addLayout</a>().</p>
<h3 class="fn"><a name="addWidget" />QLayout.addWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>w</i>)</h3><p>The <i>w</i> argument has it's ownership transferred to Qt.</p><p>Adds widget <i>w</i> to this layout in a manner specific to the
layout. This function uses <a href="qlayout.html#addItem">addItem</a>().</p>
<h3 class="fn"><a name="alignmentRect" /><a href="qrect.html">QRect</a> QLayout.alignmentRect (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Returns the rectangle that should be covered when the geometry
of this layout is set to <i>r</i>, provided that this layout
supports <a href="qlayout.html#setAlignment">setAlignment</a>().</p>
<p>The result is derived from <a href="qlayoutitem.html#sizeHint">sizeHint</a>() and expanding(). It is
never larger than <i>r</i>.</p>
<h3 class="fn"><a name="childEvent" />QLayout.childEvent (<i>self</i>, <a href="qchildevent.html">QChildEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#childEvent">QObject.childEvent</a>().</p>
<h3 class="fn"><a name="closestAcceptableSize" /><a href="qsize.html">QSize</a> QLayout.closestAcceptableSize (<a href="qwidget.html">QWidget</a> <i>w</i>, <a href="qsize.html">QSize</a> <i>s</i>)</h3><p>Returns a size that satisfies all size constraints on
<i>widget</i>, including <a href="qlayoutitem.html#heightForWidth">heightForWidth</a>() and that is
as close as possible to <i>size</i>.</p>
<h3 class="fn"><a name="contentsMargins" /><a href="qmargins.html">QMargins</a> QLayout.contentsMargins (<i>self</i>)</h3><p>Returns the margins used around the layout.</p>
<p>By default, <a href="qlayout.html">QLayout</a> uses the values
provided by the style. On most platforms, the margin is 11 pixels
in all directions.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qlayout.html#setContentsMargins">setContentsMargins</a>().</p>
<h3 class="fn"><a name="contentsRect" /><a href="qrect.html">QRect</a> QLayout.contentsRect (<i>self</i>)</h3><p>Returns the layout's <a href="qlayout.html#geometry">geometry</a>() rectangle, but taking into
account the contents margins.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qlayout.html#setContentsMargins">setContentsMargins</a>() and
<a href="qlayout.html#getContentsMargins">getContentsMargins</a>().</p>
<h3 class="fn"><a name="count" />int QLayout.count (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Must be implemented in subclasses to return the number of items
in the layout.</p>
<p><b>See also</b> <a href="qlayout.html#itemAt">itemAt</a>().</p>
<h3 class="fn"><a name="expandingDirections" /><a href="qt-orientations.html">Qt.Orientations</a> QLayout.expandingDirections (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem.expandingDirections</a>().</p>
<p>Returns whether this layout can make use of more space than
<a href="qlayoutitem.html#sizeHint">sizeHint</a>(). A value of
<a href="qt.html#Orientation-enum">Qt.Vertical</a> or <a href="qt.html#Orientation-enum">Qt.Horizontal</a> means that it wants
to grow in only one dimension, whereas <a href="qt.html#Orientation-enum">Qt.Vertical</a> | <a href="qt.html#Orientation-enum">Qt.Horizontal</a> means that it wants
to grow in both dimensions.</p>
<p>The default implementation returns <a href="qt.html#Orientation-enum">Qt.Horizontal</a> | <a href="qt.html#Orientation-enum">Qt.Vertical</a>. Subclasses reimplement
it to return a meaningful value based on their child widgets's
<a href="qsizepolicy.html">size policies</a>.</p>
<p><b>See also</b> <a href="qlayoutitem.html#sizeHint">sizeHint</a>().</p>
<h3 class="fn"><a name="geometry" /><a href="qrect.html">QRect</a> QLayout.geometry (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#geometry">QLayoutItem.geometry</a>().</p>
<p><b>See also</b> <a href="qlayout.html#setGeometry">setGeometry</a>().</p>
<h3 class="fn"><a name="getContentsMargins" />(int <i>left</i>, int <i>top</i>, int <i>right</i>, int <i>bottom</i>) QLayout.getContentsMargins (<i>self</i>)</h3><p>Extracts the left, top, right, and bottom margins used around
the layout, and assigns them to *<i>left</i>, *<i>top</i>,
*<i>right</i>, and *<i>bottom</i> (unless they are null
pointers).</p>
<p>By default, <a href="qlayout.html">QLayout</a> uses the values
provided by the style. On most platforms, the margin is 11 pixels
in all directions.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qlayout.html#setContentsMargins">setContentsMargins</a>(),
<a href="qstyle.html#pixelMetric">QStyle.pixelMetric</a>(),
<a href="qstyle.html#PixelMetric-enum">PM_LayoutLeftMargin</a>,
<a href="qstyle.html#PixelMetric-enum">PM_LayoutTopMargin</a>,
<a href="qstyle.html#PixelMetric-enum">PM_LayoutRightMargin</a>,
and <a href="qstyle.html#PixelMetric-enum">PM_LayoutBottomMargin</a>.</p>
<h3 class="fn"><a name="indexOf" />int QLayout.indexOf (<i>self</i>, <a href="qwidget.html">QWidget</a>)</h3><p>Searches for widget <i>widget</i> in this layout (not including
child layouts).</p>
<p>Returns the index of <i>widget</i>, or -1 if <i>widget</i> is
not found.</p>
<p>The default implementation iterates over all items using
<a href="qlayout.html#itemAt">itemAt</a>()</p>
<h3 class="fn"><a name="invalidate" />QLayout.invalidate (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#invalidate">QLayoutItem.invalidate</a>().</p>
<h3 class="fn"><a name="isEmpty" />bool QLayout.isEmpty (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#isEmpty">QLayoutItem.isEmpty</a>().</p>
<h3 class="fn"><a name="isEnabled" />bool QLayout.isEnabled (<i>self</i>)</h3><p>Returns true if the layout is enabled; otherwise returns
false.</p>
<p><b>See also</b> <a href="qlayout.html#setEnabled">setEnabled</a>().</p>
<h3 class="fn"><a name="itemAt" /><a href="qlayoutitem.html">QLayoutItem</a> QLayout.itemAt (<i>self</i>, int <i>index</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Must be implemented in subclasses to return the layout item at
<i>index</i>. If there is no such item, the function must return 0.
Items are numbered consecutively from 0. If an item is deleted,
other items will be renumbered.</p>
<p>This function can be used to iterate over a layout. The
following code will draw a rectangle for each layout item in the
layout structure of the widget.</p>
<pre class="cpp">
<span class="keyword">static</span> <span class="type">void</span> paintLayout(<span class="type"><a href="qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> <span class="operator">*</span>item)
{
<span class="type"><a href="qlayout.html">QLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> item<span class="operator">-</span><span class="operator">></span>layout();
<span class="keyword">if</span> (layout) {
<span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator"><</span> layout<span class="operator">-</span><span class="operator">></span>count(); <span class="operator">+</span><span class="operator">+</span>i)
paintLayout(painter<span class="operator">,</span> layout<span class="operator">-</span><span class="operator">></span>itemAt(i));
}
painter<span class="operator">-</span><span class="operator">></span>drawRect(item<span class="operator">-</span><span class="operator">></span>geometry());
}
<span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
<span class="keyword">if</span> (layout())
paintLayout(<span class="operator">&</span>painter<span class="operator">,</span> layout());
}
</pre>
<p><b>See also</b> <a href="qlayout.html#count">count</a>() and
<a href="qlayout.html#takeAt">takeAt</a>().</p>
<h3 class="fn"><a name="layout" /><a href="qlayout.html">QLayout</a> QLayout.layout (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#layout">QLayoutItem.layout</a>().</p>
<h3 class="fn"><a name="margin" />int QLayout.margin (<i>self</i>)</h3><h3 class="fn"><a name="maximumSize" /><a href="qsize.html">QSize</a> QLayout.maximumSize (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#maximumSize">QLayoutItem.maximumSize</a>().</p>
<p>Returns the maximum size of this layout. This is the largest
size that the layout can have while still respecting the
specifications.</p>
<p>The returned value doesn't include the space required by
<a href="qwidget.html#setContentsMargins">QWidget.setContentsMargins</a>()
or <a href="qlayout.html#menuBar">menuBar</a>().</p>
<p>The default implementation allows unlimited resizing.</p>
<h3 class="fn"><a name="menuBar" /><a href="qwidget.html">QWidget</a> QLayout.menuBar (<i>self</i>)</h3><p>Returns the menu bar set for this layout, or 0 if no menu bar is
set.</p>
<p><b>See also</b> <a href="qlayout.html#setMenuBar">setMenuBar</a>().</p>
<h3 class="fn"><a name="minimumSize" /><a href="qsize.html">QSize</a> QLayout.minimumSize (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem.minimumSize</a>().</p>
<p>Returns the minimum size of this layout. This is the smallest
size that the layout can have while still respecting the
specifications.</p>
<p>The returned value doesn't include the space required by
<a href="qwidget.html#setContentsMargins">QWidget.setContentsMargins</a>()
or <a href="qlayout.html#menuBar">menuBar</a>().</p>
<p>The default implementation allows unlimited resizing.</p>
<h3 class="fn"><a name="parentWidget" /><a href="qwidget.html">QWidget</a> QLayout.parentWidget (<i>self</i>)</h3><p>Returns the parent widget of this layout, or 0 if this layout is
not installed on any widget.</p>
<p>If the layout is a sub-layout, this function returns the parent
widget of the parent layout.</p>
<p><b>See also</b> <a href="qobject.html#parent">parent</a>().</p>
<h3 class="fn"><a name="removeItem" />QLayout.removeItem (<i>self</i>, <a href="qlayoutitem.html">QLayoutItem</a>)</h3><p>The <i>QLayoutItem</i> argument</p><p>Removes the layout item <i>item</i> from the layout. It is the
caller's responsibility to delete the item.</p>
<p>Notice that <i>item</i> can be a layout (since <a href="qlayout.html">QLayout</a> inherits <a href="qlayoutitem.html">QLayoutItem</a>).</p>
<p><b>See also</b> <a href="qlayout.html#removeWidget">removeWidget</a>() and <a href="qlayout.html#addItem">addItem</a>().</p>
<h3 class="fn"><a name="removeWidget" />QLayout.removeWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>w</i>)</h3><p>Removes the widget <i>widget</i> from the layout. After this
call, it is the caller's responsibility to give the widget a
reasonable geometry or to put the widget back into a layout.</p>
<p><b>Note:</b> The ownership of <i>widget</i> remains the same as
when it was added.</p>
<p><b>See also</b> <a href="qlayout.html#removeItem">removeItem</a>(), <a href="qwidget.html#geometry-prop">QWidget.setGeometry</a>(), and
<a href="qlayout.html#addWidget">addWidget</a>().</p>
<h3 class="fn"><a name="setAlignment" />bool QLayout.setAlignment (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>w</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>alignment</i>)</h3><p>Sets the alignment for widget <i>w</i> to <i>alignment</i> and
returns true if <i>w</i> is found in this layout (not including
child layouts); otherwise returns false.</p>
<h3 class="fn"><a name="setAlignment-2" />bool QLayout.setAlignment (<i>self</i>, <a href="qlayout.html">QLayout</a> <i>l</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>alignment</i>)</h3><p>Sets the alignment of this item to <i>alignment</i>.</p>
<p><b>See also</b> <a href="qlayoutitem.html#setAlignment">QLayoutItem.setAlignment</a>().</p>
<h3 class="fn"><a name="setAlignment-3" />QLayout.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>alignment</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the alignment for the layout <i>l</i> to <i>alignment</i>
and returns true if <i>l</i> is found in this layout (not including
child layouts); otherwise returns false.</p>
<h3 class="fn"><a name="setContentsMargins" />QLayout.setContentsMargins (<i>self</i>, int <i>left</i>, int <i>top</i>, int <i>right</i>, int <i>bottom</i>)</h3><p>Sets the <i>left</i>, <i>top</i>, <i>right</i>, and
<i>bottom</i> margins to use around the layout.</p>
<p>By default, <a href="qlayout.html">QLayout</a> uses the values
provided by the style. On most platforms, the margin is 11 pixels
in all directions.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qlayout.html#contentsMargins">contentsMargins</a>(), <a href="qlayout.html#getContentsMargins">getContentsMargins</a>(),
<a href="qstyle.html#pixelMetric">QStyle.pixelMetric</a>(),
<a href="qstyle.html#PixelMetric-enum">PM_LayoutLeftMargin</a>,
<a href="qstyle.html#PixelMetric-enum">PM_LayoutTopMargin</a>,
<a href="qstyle.html#PixelMetric-enum">PM_LayoutRightMargin</a>,
and <a href="qstyle.html#PixelMetric-enum">PM_LayoutBottomMargin</a>.</p>
<h3 class="fn"><a name="setContentsMargins-2" />QLayout.setContentsMargins (<i>self</i>, <a href="qmargins.html">QMargins</a> <i>margins</i>)</h3><p>Sets the <i>margins</i> to use around the layout.</p>
<p>By default, <a href="qlayout.html">QLayout</a> uses the values
provided by the style. On most platforms, the margin is 11 pixels
in all directions.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qlayout.html#contentsMargins">contentsMargins</a>().</p>
<h3 class="fn"><a name="setEnabled" />QLayout.setEnabled (<i>self</i>, bool)</h3><p>Enables this layout if <i>enable</i> is true, otherwise disables
it.</p>
<p>An enabled layout adjusts dynamically to changes; a disabled
layout acts as if it did not exist.</p>
<p>By default all layouts are enabled.</p>
<p><b>See also</b> <a href="qlayout.html#isEnabled">isEnabled</a>().</p>
<h3 class="fn"><a name="setGeometry" />QLayout.setGeometry (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem.setGeometry</a>().</p>
<p><b>See also</b> <a href="qlayout.html#geometry">geometry</a>().</p>
<h3 class="fn"><a name="setMargin" />QLayout.setMargin (<i>self</i>, int)</h3><h3 class="fn"><a name="setMenuBar" />QLayout.setMenuBar (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>w</i>)</h3><p>The <i>w</i> argument has it's ownership transferred to Qt.</p><p>Tells the geometry manager to place the menu bar <i>widget</i>
at the top of <a href="qlayout.html#parentWidget">parentWidget</a>(), outside <a href="qwidget.html#contentsMargins">QWidget.contentsMargins</a>(). All
child widgets are placed below the bottom edge of the menu bar.</p>
<p><b>See also</b> <a href="qlayout.html#menuBar">menuBar</a>().</p>
<h3 class="fn"><a name="setSizeConstraint" />QLayout.setSizeConstraint (<i>self</i>, <a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a>)</h3><h3 class="fn"><a name="setSpacing" />QLayout.setSpacing (<i>self</i>, int)</h3><h3 class="fn"><a name="sizeConstraint" /><a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a> QLayout.sizeConstraint (<i>self</i>)</h3><h3 class="fn"><a name="spacing" />int QLayout.spacing (<i>self</i>)</h3><h3 class="fn"><a name="takeAt" /><a href="qlayoutitem.html">QLayoutItem</a> QLayout.takeAt (<i>self</i>, int <i>index</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>The <i>QLayoutItem</i> result</p><p>Must be implemented in subclasses to remove the layout item at
<i>index</i> from the layout, and return the item. If there is no
such item, the function must do nothing and return 0. Items are
numbered consecutively from 0. If an item is removed, other items
will be renumbered.</p>
<p>The following code fragment shows a safe way to remove all items
from a layout:</p>
<pre class="cpp">
<span class="type"><a href="qlayoutitem.html">QLayoutItem</a></span> <span class="operator">*</span>child;
<span class="keyword">while</span> ((child <span class="operator">=</span> layout<span class="operator">-</span><span class="operator">></span>takeAt(<span class="number">0</span>)) <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) {
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="keyword">delete</span> child;
}
</pre>
<p><b>See also</b> <a href="qlayout.html#itemAt">itemAt</a>() and
<a href="qlayout.html#count">count</a>().</p>
<h3 class="fn"><a name="totalHeightForWidth" />int QLayout.totalHeightForWidth (<i>self</i>, int <i>w</i>)</h3><h3 class="fn"><a name="totalMaximumSize" /><a href="qsize.html">QSize</a> QLayout.totalMaximumSize (<i>self</i>)</h3><h3 class="fn"><a name="totalMinimumSize" /><a href="qsize.html">QSize</a> QLayout.totalMinimumSize (<i>self</i>)</h3><h3 class="fn"><a name="totalSizeHint" /><a href="qsize.html">QSize</a> QLayout.totalSizeHint (<i>self</i>)</h3><h3 class="fn"><a name="update" />QLayout.update (<i>self</i>)</h3><p>Updates the layout for <a href="qlayout.html#parentWidget">parentWidget</a>().</p>
<p>You should generally not need to call this because it is
automatically called at the most appropriate times.</p>
<p><b>See also</b> <a href="qlayout.html#activate">activate</a>()
and <a href="qlayout.html#invalidate">invalidate</a>().</p>
<h3 class="fn"><a name="widgetEvent" />QLayout.widgetEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><h3 class="fn"><a name="__len__" /> QLayout.__len__ (<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.9.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.2</td></tr></table></div></address></body></html>
|