Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > ac91357d6caede925de099a02fced14e > files > 4275

qt4-doc-4.2.1-1.el5_7.1.x86_64.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/gui/kernel/qlayout.cpp -->
<head>
  <title>Qt 4.2: QLayout Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></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>
<pre> #include &lt;QLayout&gt;</pre><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="qgridlayout.html">QGridLayout</a>, and <a href="qstackedlayout.html">QStackedLayout</a>.</p>
<ul>
<li><a href="qlayout-members.html">List of all members, including inherited members</a></li>
<li><a href="qlayout-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a></b> { SetDefaultConstraint, SetFixedSize, SetMinimumSize, SetMaximumSize, SetMinAndMaxSize, SetNoConstraint }</li>
</ul>
<a name="properties"></a>
<h3>Properties</h3>
<ul>
<li><div class="fn"/><b><a href="qlayout.html#margin-prop">margin</a></b> : int</li>
<li><div class="fn"/><b><a href="qlayout.html#sizeConstraint-prop">sizeConstraint</a></b> : SizeConstraint</li>
<li><div class="fn"/><b><a href="qlayout.html#spacing-prop">spacing</a></b> : int</li>
</ul>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qlayout.html#QLayout">QLayout</a></b> ( QWidget * <i>parent</i> )</li>
<li><div class="fn"/><b><a href="qlayout.html#QLayout-2">QLayout</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qlayout.html#activate">activate</a></b> ()</li>
<li><div class="fn"/>virtual void <b><a href="qlayout.html#addItem">addItem</a></b> ( QLayoutItem * <i>item</i> ) = 0</li>
<li><div class="fn"/>void <b><a href="qlayout.html#addWidget">addWidget</a></b> ( QWidget * <i>w</i> )</li>
<li><div class="fn"/>virtual int <b><a href="qlayout.html#count">count</a></b> () const = 0</li>
<li><div class="fn"/>virtual Qt::Orientations <b><a href="qlayout.html#expandingDirections">expandingDirections</a></b> () const</li>
<li><div class="fn"/>virtual int <b><a href="qlayout.html#indexOf">indexOf</a></b> ( QWidget * <i>widget</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qlayout.html#isEnabled">isEnabled</a></b> () const</li>
<li><div class="fn"/>virtual QLayoutItem * <b><a href="qlayout.html#itemAt">itemAt</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>int <b><a href="qlayout.html#margin-prop">margin</a></b> () const</li>
<li><div class="fn"/>virtual QSize <b><a href="qlayout.html#maximumSize">maximumSize</a></b> () const</li>
<li><div class="fn"/>QWidget * <b><a href="qlayout.html#menuBar">menuBar</a></b> () const</li>
<li><div class="fn"/>virtual QSize <b><a href="qlayout.html#minimumSize">minimumSize</a></b> () const</li>
<li><div class="fn"/>QWidget * <b><a href="qlayout.html#parentWidget">parentWidget</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qlayout.html#removeItem">removeItem</a></b> ( QLayoutItem * <i>item</i> )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#removeWidget">removeWidget</a></b> ( QWidget * <i>widget</i> )</li>
<li><div class="fn"/>bool <b><a href="qlayout.html#setAlignment">setAlignment</a></b> ( 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> ( QLayout * <i>l</i>, Qt::Alignment <i>alignment</i> )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#setEnabled">setEnabled</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#margin-prop">setMargin</a></b> ( int )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#setMenuBar">setMenuBar</a></b> ( QWidget * <i>widget</i> )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a></b> ( SizeConstraint )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#spacing-prop">setSpacing</a></b> ( int )</li>
<li><div class="fn"/>SizeConstraint <b><a href="qlayout.html#sizeConstraint-prop">sizeConstraint</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qlayout.html#spacing-prop">spacing</a></b> () const</li>
<li><div class="fn"/>virtual QLayoutItem * <b><a href="qlayout.html#takeAt">takeAt</a></b> ( int <i>index</i> ) = 0</li>
<li><div class="fn"/>void <b><a href="qlayout.html#update">update</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>16 public functions inherited from <a href="qlayoutitem.html#public-functions">QLayoutItem</a></li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</h3>
<ul>
<li><div class="fn"/>QSize <b><a href="qlayout.html#closestAcceptableSize">closestAcceptableSize</a></b> ( const QWidget * <i>widget</i>, const QSize &amp; <i>size</i> )</li>
</ul>
<ul>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>void <b><a href="qlayout.html#addChildLayout">addChildLayout</a></b> ( QLayout * <i>l</i> )</li>
<li><div class="fn"/>void <b><a href="qlayout.html#addChildWidget">addChildWidget</a></b> ( QWidget * <i>w</i> )</li>
<li><div class="fn"/>QRect <b><a href="qlayout.html#alignmentRect">alignmentRect</a></b> ( const QRect &amp; <i>r</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="details"></a>
<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>, 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 Classes</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="qlayoutitem.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>
<p>See also <a href="qlayoutitem.html">QLayoutItem</a>, <a href="layout.html">Layout Classes</a>, <a href="layouts-basiclayouts.html">Basic Layouts Example</a>, <a href="layouts-borderlayout.html">Border Layout Example</a>, and <a href="layouts-flowlayout.html">Flow Layout Example</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="SizeConstraint-enum"></a>enum QLayout::SizeConstraint</h3>
<p>The possible values are:</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QLayout::SetDefaultConstraint</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">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 valign="top"><tt>QLayout::SetFixedSize</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">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 valign="top"><tt>QLayout::SetMinimumSize</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The main widget's minimum size is set to <a href="qlayout.html#minimumSize">minimumSize</a>(); it cannot be smaller.</td></tr>
<tr><td valign="top"><tt>QLayout::SetMaximumSize</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The main widget's maximum size is set to <a href="qlayout.html#maximumSize">maximumSize</a>(); it cannot be larger.</td></tr>
<tr><td valign="top"><tt>QLayout::SetMinAndMaxSize</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">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 valign="top"><tt>QLayout::SetNoConstraint</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The widget is not constrained.</td></tr>
</table></p>
<p>See also <a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a>().</p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="margin-prop"></a>margin : int</h3>
<p>This property holds the width of the outside border of the layout.</p>
<p>The margin default is provided by the style. The default margin most Qt styles specify is 9 for child widgets and 11 for windows.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>int margin () const</b></li>
<li><div class="fn"/><b>void setMargin ( int )</b></li>
</ul>
<p>See also <a href="qlayout.html#spacing-prop">spacing</a>.</p>
<h3 class="fn"><a name="sizeConstraint-prop"></a>sizeConstraint : <a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a></h3>
<p>This property holds the resize mode of the layout.</p>
<p>The default mode is <a href="qlayout.html#SizeConstraint-enum">SetDefaultConstraint</a>.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>SizeConstraint sizeConstraint () const</b></li>
<li><div class="fn"/><b>void setSizeConstraint ( SizeConstraint )</b></li>
</ul>
<h3 class="fn"><a name="spacing-prop"></a>spacing : int</h3>
<p>This property holds the spacing between widgets inside the layout.</p>
<p>The default value is -1, which signifies that the layout's spacing is inherited from the parent layout, or from the style settings for the parent widget.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>int spacing () const</b></li>
<li><div class="fn"/><b>void setSpacing ( int )</b></li>
</ul>
<p>See also <a href="qlayout.html#margin-prop">margin</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QLayout"></a>QLayout::QLayout ( <a href="qwidget.html">QWidget</a> * <i>parent</i> )</h3>
<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"></a>QLayout::QLayout ()</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"></a>bool QLayout::activate ()</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.</p>
<p>See also <a href="qlayout.html#update">update</a>() and <a href="qwidget.html#updateGeometry">QWidget::updateGeometry</a>().</p>
<h3 class="fn"><a name="addChildLayout"></a>void QLayout::addChildLayout ( QLayout * <i>l</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This function is called from <tt>addLayout()</tt> functions in subclasses to add layout <i>l</i> as a sub-layout.</p>
<h3 class="fn"><a name="addChildWidget"></a>void QLayout::addChildWidget ( <a href="qwidget.html">QWidget</a> * <i>w</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This function is called from <tt>addWidget()</tt> functions in subclasses to add <i>w</i> as a child widget.</p>
<p>If <i>w</i> is already in a layout, this function will give a warning and remove <i>w</i> from the 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"></a>void QLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a> * <i>item</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Implemented in subclasses to add an <i>item</i>. How it is added is specific to each subclass.</p>
<p>The ownership of <i>item</i> is transferred to the layout, and it's the layout's responsibility to delete it.</p>
<h3 class="fn"><a name="addWidget"></a>void QLayout::addWidget ( <a href="qwidget.html">QWidget</a> * <i>w</i> )</h3>
<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><a href="qrect.html">QRect</a> QLayout::alignmentRect ( const <a href="qrect.html">QRect</a> &amp; <i>r</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></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="closestAcceptableSize"></a><a href="qsize.html">QSize</a> QLayout::closestAcceptableSize ( const <a href="qwidget.html">QWidget</a> * <i>widget</i>, const <a href="qsize.html">QSize</a> &amp; <i>size</i> )&nbsp;&nbsp;<tt> [static]</tt></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="count"></a>int QLayout::count () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Must be implemented in subclasses to return the number of items in the layout.</p>
<p>See also <a href="qlayout.html#itemAt">itemAt</a>().</p>
<h3 class="fn"><a name="expandingDirections"></a><a href="qt.html#Orientation-enum">Qt::Orientations</a> QLayout::expandingDirections () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<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>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem</a>.</p>
<p>See also <a href="qlayoutitem.html#sizeHint">sizeHint</a>().</p>
<h3 class="fn"><a name="indexOf"></a>int QLayout::indexOf ( <a href="qwidget.html">QWidget</a> * <i>widget</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></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="isEnabled"></a>bool QLayout::isEnabled () const</h3>
<p>Returns true if the layout is enabled; otherwise returns false.</p>
<p>See also <a href="qlayout.html#setEnabled">setEnabled</a>().</p>
<h3 class="fn"><a name="itemAt"></a><a href="qlayoutitem.html">QLayoutItem</a> * QLayout::itemAt ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<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> static void paintLayout(QPainter *painter, QLayoutItem *item)
 {
     QLayout *layout = item-&gt;layout();
     if (layout) {
         for (int i = 0; i &lt; layout-&gt;count(); ++i)
             paintLayout(painter, layout-&gt;itemAt(i));
     }
     painter-&gt;drawRect(lay-&gt;geometry());
 }

 void MyWidget::paintEvent(QPaintEvent *)
 {
     QPainter painter(this);
     if (layout())
         paintLayout(&amp;painter, layout());
 }</pre>
<p>See also <a href="qlayout.html#count">count</a>() and <a href="qlayout.html#takeAt">takeAt</a>().</p>
<h3 class="fn"><a name="maximumSize"></a><a href="qsize.html">QSize</a> QLayout::maximumSize () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<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>
<p>Reimplemented from <a href="qlayoutitem.html#maximumSize">QLayoutItem</a>.</p>
<h3 class="fn"><a name="menuBar"></a><a href="qwidget.html">QWidget</a> * QLayout::menuBar () const</h3>
<p>Returns the menu bar set for this layout, or 0 if no menu bar is set.</p>
<p>See also <a href="qlayout.html#setMenuBar">setMenuBar</a>().</p>
<h3 class="fn"><a name="minimumSize"></a><a href="qsize.html">QSize</a> QLayout::minimumSize () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<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>
<p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem</a>.</p>
<h3 class="fn"><a name="parentWidget"></a><a href="qwidget.html">QWidget</a> * QLayout::parentWidget () const</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>See also <a href="qobject.html#parent">parent</a>().</p>
<h3 class="fn"><a name="removeItem"></a>void QLayout::removeItem ( <a href="qlayoutitem.html">QLayoutItem</a> * <i>item</i> )</h3>
<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>See also <a href="qlayout.html#removeWidget">removeWidget</a>() and <a href="qlayout.html#addItem">addItem</a>().</p>
<h3 class="fn"><a name="removeWidget"></a>void QLayout::removeWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</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>See also <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"></a>bool QLayout::setAlignment ( <a href="qwidget.html">QWidget</a> * <i>w</i>, <a href="qt.html#AlignmentFlag-enum">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"></a>bool QLayout::setAlignment ( QLayout * <i>l</i>, <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> <i>alignment</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</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="setEnabled"></a>void QLayout::setEnabled ( bool <i>enable</i> )</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>See also <a href="qlayout.html#isEnabled">isEnabled</a>().</p>
<h3 class="fn"><a name="setMenuBar"></a>void QLayout::setMenuBar ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
<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 QWidget::contentsMargins(). All child widgets are placed below the bottom edge of the menu bar.</p>
<p>See also <a href="qlayout.html#menuBar">menuBar</a>().</p>
<h3 class="fn"><a name="takeAt"></a><a href="qlayoutitem.html">QLayoutItem</a> * QLayout::takeAt ( int <i>index</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<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 deleted, other items will be renumbered.</p>
<p>The following code fragment shows a safe way to remove all items from a layout:</p>
<pre> QLayoutItem *child;
 while ((child = layout-&gt;takeAt(0)) != 0) {
     ...
     delete child;
 }</pre>
<p>See also <a href="qlayout.html#itemAt">itemAt</a>() and <a href="qlayout.html#count">count</a>().</p>
<h3 class="fn"><a name="update"></a>void QLayout::update ()</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>See also <a href="qlayout.html#activate">activate</a>() and <a href="qlayoutitem.html#invalidate">invalidate</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QLayout-4"></a>QLayout::QLayout ( <a href="qwidget.html">QWidget</a> * <i>parent</i>, int <i>margin</i>, int <i>spacing</i> = -1, const char * <i>name</i> = 0 )</h3>
<p>Constructs a new top-level <a href="qlayout.html">QLayout</a> called <i>name</i>, with parent widget <i>parent</i>. <i>parent</i> may not be 0.</p>
<p>The <i>margin</i> is the number of pixels between the edge of the widget and the managed children. The <i>spacing</i> sets the value of <a href="qlayout.html#spacing-prop">spacing</a>(), which gives the spacing between the managed widgets. If <i>spacing</i> is -1 (the default), spacing is set to the value of <i>margin</i>.</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>
<p>See also <a href="qwidget.html#setLayout">QWidget::setLayout</a>().</p>
<h3 class="fn"><a name="QLayout-5"></a>QLayout::QLayout ( QLayout * <i>parentLayout</i>, int <i>spacing</i> = -1, const char * <i>name</i> = 0 )</h3>
<p>Constructs a new child <a href="qlayout.html">QLayout</a> called <i>name</i>, and places it inside <i>parentLayout</i> by using the default placement defined by <a href="qlayout.html#addItem">addItem</a>().</p>
<p>If <i>spacing</i> is -1, this <a href="qlayout.html">QLayout</a> inherits <i>parentLayout</i>'s <a href="qlayout.html#spacing-prop">spacing</a>(), otherwise the value of <i>spacing</i> is used.</p>
<h3 class="fn"><a name="QLayout-6"></a>QLayout::QLayout ( int <i>spacing</i>, const char * <i>name</i> = 0 )</h3>
<p>Constructs a new child <a href="qlayout.html">QLayout</a> called <i>name</i>. If <i>spacing</i> is -1, this <a href="qlayout.html">QLayout</a> inherits its parent's <a href="qlayout.html#spacing-prop">spacing</a>(); otherwise the value of <i>spacing</i> is used.</p>
<p>This layout has to be inserted into another layout before geometry management will work.</p>
<h3 class="fn"><a name="add"></a>void QLayout::add ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
<p>Use addWidget(<i>widget</i>) instead.</p>
<h3 class="fn"><a name="autoAdd"></a>bool QLayout::autoAdd () const</h3>
<p>Automatically adding widgets is deprecated. Use <a href="qlayout.html#addWidget">addWidget</a>() or addLayout() instead.</p>
<p>See also <a href="qlayout-qt3.html#setAutoAdd">setAutoAdd</a>().</p>
<h3 class="fn"><a name="defaultBorder"></a>int QLayout::defaultBorder () const</h3>
<p>Use <a href="qlayout.html#spacing-prop">spacing</a>() instead.</p>
<h3 class="fn"><a name="deleteAllItems"></a>void QLayout::deleteAllItems ()&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Removes and deletes all items in this layout.</p>
<h3 class="fn"><a name="freeze"></a>void QLayout::freeze ( int <i>w</i> = 0, int <i>h</i> = 0 )</h3>
<p>Sets this layout's parent widget to a fixed size with width <i>w</i> and height <i>h</i>, stopping the user form resizing it, and also prevents the layout from resizing it, even if the layout's size hint should change. Does nothing if this is not a top-level layout (i.e., if <a href="qobject.html#parent">parent</a>()-&gt;<a href="qobject.html#isWidgetType">isWidgetType</a>()).</p>
<p>As a special case, if both <i>w</i> and <i>h</i> are 0, then the layout's current <a href="qlayoutitem.html#sizeHint">sizeHint</a>() is used.</p>
<p>Use <tt>setResizeMode(Fixed)</tt> to stop the widget from being resized by the user, while still allowing the layout to resize it when the <a href="qlayoutitem.html#sizeHint">sizeHint</a>() changes.</p>
<p>Use <tt>setResizeMode(FreeResize)</tt> to allow the user to resize the widget, while preventing the layout from resizing it.</p>
<h3 class="fn"><a name="isTopLevel"></a>bool QLayout::isTopLevel () const</h3>
<p>Returns true if this layout is a top-level layout, i.e. not a child of another layout; otherwise returns false.</p>
<h3 class="fn"><a name="iterator"></a>QLayoutIterator QLayout::iterator ()</h3>
<p>Use a <a href="porting4.html#qlayoutiterator">QLayoutIterator</a>() constructor instead.</p>
<h3 class="fn"><a name="mainWidget"></a><a href="qwidget.html">QWidget</a> * QLayout::mainWidget () const</h3>
<p>Use <a href="qlayout.html#parentWidget">parentWidget</a>() instead.</p>
<h3 class="fn"><a name="remove"></a>void QLayout::remove ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
<p>Use removeWidget(<i>widget</i>) instead.</p>
<h3 class="fn"><a name="resizeMode"></a><a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a> QLayout::resizeMode () const</h3>
<p>Use <a href="qlayout.html#sizeConstraint-prop">sizeConstraint</a>() instead.</p>
<p>See also <a href="qlayout-qt3.html#setResizeMode">setResizeMode</a>().</p>
<h3 class="fn"><a name="setAutoAdd"></a>void QLayout::setAutoAdd ( bool <i>a</i> )</h3>
<p>Automatically adding widgets is deprecated. Use <a href="qlayout.html#addWidget">addWidget</a>() or addLayout() instead.</p>
<p>See also <a href="qlayout-qt3.html#autoAdd">autoAdd</a>().</p>
<h3 class="fn"><a name="setResizeMode"></a>void QLayout::setResizeMode ( <a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a> <i>constraint</i> )</h3>
<p>Use setSizeConstraint(<i>constraint</i>) instead.</p>
<p>See also <a href="qlayout-qt3.html#resizeMode">resizeMode</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2006 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.2.1</div></td>
</tr></table></div></address></body>
</html>