~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qlayout.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/kernel/qlayout.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QLayout Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<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="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QLayout Class Reference</h1>
 
21
<p>The QLayout class is the base class of geometry managers. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QLayout&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a> and <a href="qlayoutitem.html">QLayoutItem</a>.</p>
 
24
<p>Inherited by <a href="qboxlayout.html">QBoxLayout</a>, <a href="qgridlayout.html">QGridLayout</a>, and <a href="qstackedlayout.html">QStackedLayout</a>.</p>
 
25
<ul>
 
26
<li><a href="qlayout-members.html">List of all members, including inherited members</a></li>
 
27
<li><a href="qlayout-qt3.html">Qt 3 support members</a></li>
 
28
</ul>
 
29
<a name="public-types"></a>
 
30
<h3>Public Types</h3>
 
31
<ul>
 
32
<li><div class="fn"/>enum <b><a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a></b> { SetDefaultConstraint, SetFixedSize, SetMinimumSize, SetMaximumSize, SetMinAndMaxSize, SetNoConstraint }</li>
 
33
</ul>
 
34
<a name="properties"></a>
 
35
<h3>Properties</h3>
 
36
<ul>
 
37
<li><div class="fn"/><b><a href="qlayout.html#margin-prop">margin</a></b> : int</li>
 
38
<li><div class="fn"/><b><a href="qlayout.html#sizeConstraint-prop">sizeConstraint</a></b> : SizeConstraint</li>
 
39
<li><div class="fn"/><b><a href="qlayout.html#spacing-prop">spacing</a></b> : int</li>
 
40
</ul>
 
41
<ul>
 
42
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
43
</ul>
 
44
<a name="public-functions"></a>
 
45
<h3>Public Functions</h3>
 
46
<ul>
 
47
<li><div class="fn"/><b><a href="qlayout.html#QLayout">QLayout</a></b> ( QWidget * <i>parent</i> )</li>
 
48
<li><div class="fn"/><b><a href="qlayout.html#QLayout-2">QLayout</a></b> ()</li>
 
49
<li><div class="fn"/>bool <b><a href="qlayout.html#activate">activate</a></b> ()</li>
 
50
<li><div class="fn"/>virtual void <b><a href="qlayout.html#addItem">addItem</a></b> ( QLayoutItem * <i>item</i> ) = 0</li>
 
51
<li><div class="fn"/>void <b><a href="qlayout.html#addWidget">addWidget</a></b> ( QWidget * <i>w</i> )</li>
 
52
<li><div class="fn"/>virtual int <b><a href="qlayout.html#count">count</a></b> () const = 0</li>
 
53
<li><div class="fn"/>virtual Qt::Orientations <b><a href="qlayout.html#expandingDirections">expandingDirections</a></b> () const</li>
 
54
<li><div class="fn"/>virtual int <b><a href="qlayout.html#indexOf">indexOf</a></b> ( QWidget * <i>widget</i> ) const</li>
 
55
<li><div class="fn"/>virtual void <b><a href="qlayout.html#invalidate">invalidate</a></b> ()</li>
 
56
<li><div class="fn"/>virtual bool <b><a href="qlayout.html#isEmpty">isEmpty</a></b> () const</li>
 
57
<li><div class="fn"/>bool <b><a href="qlayout.html#isEnabled">isEnabled</a></b> () const</li>
 
58
<li><div class="fn"/>virtual QLayoutItem * <b><a href="qlayout.html#itemAt">itemAt</a></b> ( int <i>index</i> ) const = 0</li>
 
59
<li><div class="fn"/>int <b><a href="qlayout.html#margin-prop">margin</a></b> () const</li>
 
60
<li><div class="fn"/>virtual QSize <b><a href="qlayout.html#maximumSize">maximumSize</a></b> () const</li>
 
61
<li><div class="fn"/>QWidget * <b><a href="qlayout.html#menuBar">menuBar</a></b> () const</li>
 
62
<li><div class="fn"/>virtual QSize <b><a href="qlayout.html#minimumSize">minimumSize</a></b> () const</li>
 
63
<li><div class="fn"/>QWidget * <b><a href="qlayout.html#parentWidget">parentWidget</a></b> () const</li>
 
64
<li><div class="fn"/>void <b><a href="qlayout.html#removeItem">removeItem</a></b> ( QLayoutItem * <i>item</i> )</li>
 
65
<li><div class="fn"/>void <b><a href="qlayout.html#removeWidget">removeWidget</a></b> ( QWidget * <i>widget</i> )</li>
 
66
<li><div class="fn"/>bool <b><a href="qlayout.html#setAlignment">setAlignment</a></b> ( QWidget * <i>w</i>, Qt::Alignment <i>alignment</i> )</li>
 
67
<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>
 
68
<li><div class="fn"/>void <b><a href="qlayout.html#setEnabled">setEnabled</a></b> ( bool <i>enable</i> )</li>
 
69
<li><div class="fn"/>virtual void <b><a href="qlayout.html#setGeometry">setGeometry</a></b> ( const QRect &amp; <i>r</i> ) = 0</li>
 
70
<li><div class="fn"/>void <b><a href="qlayout.html#margin-prop">setMargin</a></b> ( int )</li>
 
71
<li><div class="fn"/>void <b><a href="qlayout.html#setMenuBar">setMenuBar</a></b> ( QWidget * <i>widget</i> )</li>
 
72
<li><div class="fn"/>void <b><a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a></b> ( SizeConstraint )</li>
 
73
<li><div class="fn"/>void <b><a href="qlayout.html#spacing-prop">setSpacing</a></b> ( int )</li>
 
74
<li><div class="fn"/>SizeConstraint <b><a href="qlayout.html#sizeConstraint-prop">sizeConstraint</a></b> () const</li>
 
75
<li><div class="fn"/>int <b><a href="qlayout.html#spacing-prop">spacing</a></b> () const</li>
 
76
<li><div class="fn"/>virtual QLayoutItem * <b><a href="qlayout.html#takeAt">takeAt</a></b> ( int <i>index</i> ) = 0</li>
 
77
<li><div class="fn"/>void <b><a href="qlayout.html#update">update</a></b> ()</li>
 
78
</ul>
 
79
<ul>
 
80
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
81
<li><div class="fn"/>16 public functions inherited from <a href="qlayoutitem.html#public-functions">QLayoutItem</a></li>
 
82
</ul>
 
83
<a name="static-public-members"></a>
 
84
<h3>Static Public Members</h3>
 
85
<ul>
 
86
<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>
 
87
</ul>
 
88
<ul>
 
89
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
90
</ul>
 
91
<a name="protected-functions"></a>
 
92
<h3>Protected Functions</h3>
 
93
<ul>
 
94
<li><div class="fn"/>void <b><a href="qlayout.html#addChildLayout">addChildLayout</a></b> ( QLayout * <i>l</i> )</li>
 
95
<li><div class="fn"/>void <b><a href="qlayout.html#addChildWidget">addChildWidget</a></b> ( QWidget * <i>w</i> )</li>
 
96
<li><div class="fn"/>QRect <b><a href="qlayout.html#alignmentRect">alignmentRect</a></b> ( const QRect &amp; <i>r</i> ) const</li>
 
97
</ul>
 
98
<ul>
 
99
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
100
</ul>
 
101
<h3>Additional Inherited Members</h3>
 
102
<ul>
 
103
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
104
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
105
</ul>
 
106
<a name="details"></a>
 
107
<hr />
 
108
<h2>Detailed Description</h2>
 
109
<p>The QLayout class is the base class of geometry managers.</p>
 
110
<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>
 
111
<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>
 
112
<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>
 
113
<p>Geometry management stops when the layout manager is deleted.</p>
 
114
<p>See also <a href="qlayoutitem.html">QLayoutItem</a> and <a href="layout.html">Layout Classes</a>.</p>
 
115
<hr />
 
116
<h2>Member Type Documentation</h2>
 
117
<h3 class="fn"><a name="SizeConstraint-enum"></a>enum QLayout::SizeConstraint</h3>
 
118
<p>The possible values are:</p>
 
119
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
120
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
121
<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>
 
122
<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>
 
123
<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>
 
124
<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>
 
125
<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>
 
126
<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>
 
127
</table>
 
128
<p>See also <a href="qlayout.html#sizeConstraint-prop">setSizeConstraint</a>().</p>
 
129
<hr />
 
130
<h2>Property Documentation</h2>
 
131
<h3 class="fn"><a name="margin-prop"></a>margin : int</h3>
 
132
<p>This property holds the width of the outside border of the layout.</p>
 
133
<p>Access functions:</p>
 
134
<ul>
 
135
<li><div class="fn"/><b>int margin () const</b></li>
 
136
<li><div class="fn"/><b>void setMargin ( int )</b></li>
 
137
</ul>
 
138
<p>See also <a href="qlayout.html#spacing-prop">spacing</a>.</p>
 
139
<h3 class="fn"><a name="sizeConstraint-prop"></a>sizeConstraint : <a href="qlayout.html#SizeConstraint-enum">SizeConstraint</a></h3>
 
140
<p>This property holds the resize mode of the layout.</p>
 
141
<p>The default mode is <a href="qlayout.html#SizeConstraint-enum">SetDefaultConstraint</a>.</p>
 
142
<p>Access functions:</p>
 
143
<ul>
 
144
<li><div class="fn"/><b>SizeConstraint sizeConstraint () const</b></li>
 
145
<li><div class="fn"/><b>void setSizeConstraint ( SizeConstraint )</b></li>
 
146
</ul>
 
147
<h3 class="fn"><a name="spacing-prop"></a>spacing : int</h3>
 
148
<p>This property holds the spacing between widgets inside the layout.</p>
 
149
<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>
 
150
<p>Access functions:</p>
 
151
<ul>
 
152
<li><div class="fn"/><b>int spacing () const</b></li>
 
153
<li><div class="fn"/><b>void setSpacing ( int )</b></li>
 
154
</ul>
 
155
<p>See also <a href="qlayout.html#margin-prop">margin</a>.</p>
 
156
<hr />
 
157
<h2>Member Function Documentation</h2>
 
158
<h3 class="fn"><a name="QLayout"></a>QLayout::QLayout ( <a href="qwidget.html">QWidget</a> * <i>parent</i> )</h3>
 
159
<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>
 
160
<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>
 
161
<h3 class="fn"><a name="QLayout-2"></a>QLayout::QLayout ()</h3>
 
162
<p>Constructs a new child <a href="qlayout.html">QLayout</a>.</p>
 
163
<p>This layout has to be inserted into another layout before geometry management will work.</p>
 
164
<h3 class="fn"><a name="activate"></a>bool QLayout::activate ()</h3>
 
165
<p>Redoes the layout for <a href="qlayout.html#parentWidget">parentWidget</a>() if necessary.</p>
 
166
<p>You should generally not need to call this because it is automatically called at the most appropriate times.</p>
 
167
<p>See also <a href="qlayout.html#update">update</a>() and <a href="qwidget.html#updateGeometry">QWidget::updateGeometry</a>().</p>
 
168
<h3 class="fn"><a name="addChildLayout"></a>void QLayout::addChildLayout ( QLayout * <i>l</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
 
169
<p>This function is called from <tt>addLayout()</tt> functions in subclasses to add layout <i>l</i> as a sub-layout.</p>
 
170
<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>
 
171
<p>This function is called from <tt>addWidget()</tt> functions in subclasses to add <i>w</i> as a child widget.</p>
 
172
<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>
 
173
<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>
 
174
<p>Implemented in subclasses to add an <i>item</i>. How it is added is specific to each subclass.</p>
 
175
<p>The ownership of <i>item</i> is transferred to the layout, and it's the layout's responsibility to delete it.</p>
 
176
<h3 class="fn"><a name="addWidget"></a>void QLayout::addWidget ( <a href="qwidget.html">QWidget</a> * <i>w</i> )</h3>
 
177
<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>
 
178
<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>
 
179
<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>
 
180
<p>The result is derived from <a href="qlayoutitem.html#sizeHint">sizeHint</a>() and expanding(). It is never larger than <i>r</i>.</p>
 
181
<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>
 
182
<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>
 
183
<h3 class="fn"><a name="count"></a>int QLayout::count () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
184
<p>Must be implemented in subclasses to return the number of items in the layout.</p>
 
185
<p>See also <a href="qlayout.html#itemAt">itemAt</a>().</p>
 
186
<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>
 
187
<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>
 
188
<p>The default implementation returns <a href="qt.html#Orientation-enum">Qt::Vertical</a> | <a href="qt.html#Orientation-enum">Qt::Horizontal</a>.</p>
 
189
<p>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem</a>.</p>
 
190
<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>
 
191
<p>Searches for widget <i>widget</i> in this layout (not including child layouts).</p>
 
192
<p>Returns the index of <i>widget</i>, or -1 if <i>widget</i> is not found.</p>
 
193
<p>The default implementation iterates over all items using <a href="qlayout.html#itemAt">itemAt</a>()</p>
 
194
<h3 class="fn"><a name="invalidate"></a>void QLayout::invalidate ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
195
<p>Invalidates cached information. Reimplementations must call this.</p>
 
196
<p>Reimplemented from <a href="qlayoutitem.html#invalidate">QLayoutItem</a>.</p>
 
197
<h3 class="fn"><a name="isEmpty"></a>bool QLayout::isEmpty () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
198
<p>Returns true if this layout is empty. The default implementation iterates over all items and returns true if all child items are empty.</p>
 
199
<p>Reimplemented from <a href="qlayoutitem.html#isEmpty">QLayoutItem</a>.</p>
 
200
<h3 class="fn"><a name="isEnabled"></a>bool QLayout::isEnabled () const</h3>
 
201
<p>Returns true if the layout is enabled; otherwise returns false.</p>
 
202
<p>See also <a href="qlayout.html#setEnabled">setEnabled</a>().</p>
 
203
<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>
 
204
<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>
 
205
<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>
 
206
<pre>&nbsp;   static void paintLayout(QPainter *painter, QLayoutItem *item)
 
207
    {
 
208
        QLayout *layout = item-&gt;layout();
 
209
        if (layout) {
 
210
            for (int i = 0; i &lt; layout-&gt;count(); ++i)
 
211
                paintLayout(painter, layout-&gt;itemAt(i));
 
212
        }
 
213
        painter-&gt;drawRect(lay-&gt;geometry());
 
214
    }
 
215
 
 
216
    void MyWidget::paintEvent(QPaintEvent *)
 
217
    {
 
218
        QPainter painter(this);
 
219
        if (layout())
 
220
            paintLayout(&amp;painter, layout());
 
221
    }</pre>
 
222
<p>See also <a href="qlayout.html#count">count</a>() and <a href="qlayout.html#takeAt">takeAt</a>().</p>
 
223
<h3 class="fn"><a name="maximumSize"></a><a href="qsize.html">QSize</a> QLayout::maximumSize () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
224
<p>Returns the maximum size of this layout. This is the largest size that the layout can have while still respecting the specifications. Does not include what's needed by <a href="qwidget.html#setContentsMargins">QWidget::setContentsMargins</a>() or <a href="qlayout.html#menuBar">menuBar</a>().</p>
 
225
<p>The default implementation allows unlimited resizing.</p>
 
226
<p>Reimplemented from <a href="qlayoutitem.html#maximumSize">QLayoutItem</a>.</p>
 
227
<h3 class="fn"><a name="menuBar"></a><a href="qwidget.html">QWidget</a> * QLayout::menuBar () const</h3>
 
228
<p>Returns the menu bar set for this layout, or 0 if no menu bar is set.</p>
 
229
<h3 class="fn"><a name="minimumSize"></a><a href="qsize.html">QSize</a> QLayout::minimumSize () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
230
<p>Returns the minimum size of this layout. This is the smallest size that the layout can have while still respecting the specifications. Does not include what's needed by <a href="qwidget.html#setContentsMargins">QWidget::setContentsMargins</a>() or <a href="qlayout.html#menuBar">menuBar</a>().</p>
 
231
<p>The default implementation allows unlimited resizing.</p>
 
232
<p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem</a>.</p>
 
233
<h3 class="fn"><a name="parentWidget"></a><a href="qwidget.html">QWidget</a> * QLayout::parentWidget () const</h3>
 
234
<p>Returns the parent widget of this layout, or 0 if this layout is a sub-layout that is not yet inserted.</p>
 
235
<h3 class="fn"><a name="removeItem"></a>void QLayout::removeItem ( <a href="qlayoutitem.html">QLayoutItem</a> * <i>item</i> )</h3>
 
236
<p>Removes the layout item <i>item</i> from the layout. It is the caller's responsibility to delete the item.</p>
 
237
<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>
 
238
<p>See also <a href="qlayout.html#removeWidget">removeWidget</a>() and <a href="qlayout.html#addItem">addItem</a>().</p>
 
239
<h3 class="fn"><a name="removeWidget"></a>void QLayout::removeWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
 
240
<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>
 
241
<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>
 
242
<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>
 
243
<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>
 
244
<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>
 
245
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
246
<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>
 
247
<h3 class="fn"><a name="setEnabled"></a>void QLayout::setEnabled ( bool <i>enable</i> )</h3>
 
248
<p>Enables this layout if <i>enable</i> is true, otherwise disables it.</p>
 
249
<p>An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.</p>
 
250
<p>By default all layouts are enabled.</p>
 
251
<p>See also <a href="qlayout.html#isEnabled">isEnabled</a>().</p>
 
252
<h3 class="fn"><a name="setGeometry"></a>void QLayout::setGeometry ( const <a href="qrect.html">QRect</a> &amp; <i>r</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
253
<p>This function is reimplemented in subclasses to perform layout.</p>
 
254
<p>The default implementation maintains the <a href="qlayout.html#geometry">geometry</a>() information given by rect <i>r</i>. Reimplementors must call this function.</p>
 
255
<p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem</a>.</p>
 
256
<h3 class="fn"><a name="setMenuBar"></a>void QLayout::setMenuBar ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
 
257
<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>
 
258
<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>
 
259
<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>
 
260
<p>The following code fragment shows a safe way to remove all items from a layout:</p>
 
261
<pre>&nbsp;   QLayoutItem *child;
 
262
    while ((child = layout-&gt;takeAt(0)) != 0) {
 
263
        ...
 
264
        delete child;
 
265
    }</pre>
 
266
<p>See also <a href="qlayout.html#itemAt">itemAt</a>() and <a href="qlayout.html#count">count</a>().</p>
 
267
<h3 class="fn"><a name="update"></a>void QLayout::update ()</h3>
 
268
<p>Updates the layout for <a href="qlayout.html#parentWidget">parentWidget</a>().</p>
 
269
<p>You should generally not need to call this because it is automatically called at the most appropriate times.</p>
 
270
<p>See also <a href="qlayout.html#activate">activate</a>() and <a href="qlayout.html#invalidate">invalidate</a>().</p>
 
271
<p /><address><hr /><div align="center">
 
272
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
273
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
274
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
275
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
276
</tr></table></div></address></body>
 
277
</html>