source: trunk/doc/html/qboxlayout.html@ 203

Last change on this file since 203 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 24.2 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qlayout.cpp:1616 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QBoxLayout Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QBoxLayout Class Reference</h1>
33
34<p>The QBoxLayout class lines up child widgets horizontally or
35vertically.
36<a href="#details">More...</a>
37<p><tt>#include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;</tt>
38<p>Inherits <a href="qlayout.html">QLayout</a>.
39<p>Inherited by <a href="qhboxlayout.html">QHBoxLayout</a> and <a href="qvboxlayout.html">QVBoxLayout</a>.
40<p><a href="qboxlayout-members.html">List of all member functions.</a>
41<h2>Public Members</h2>
42<ul>
43<li class=fn>enum <a href="#Direction-enum"><b>Direction</b></a> { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }</li>
44<li class=fn><a href="#QBoxLayout"><b>QBoxLayout</b></a> ( QWidget&nbsp;*&nbsp;parent, Direction&nbsp;d, int&nbsp;margin = 0, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
45<li class=fn><a href="#QBoxLayout-2"><b>QBoxLayout</b></a> ( QLayout&nbsp;*&nbsp;parentLayout, Direction&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
46<li class=fn><a href="#QBoxLayout-3"><b>QBoxLayout</b></a> ( Direction&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
47<li class=fn><a href="#~QBoxLayout"><b>~QBoxLayout</b></a> ()</li>
48<li class=fn>virtual void <a href="#addItem"><b>addItem</b></a> ( QLayoutItem&nbsp;*&nbsp;item )</li>
49<li class=fn>Direction <a href="#direction"><b>direction</b></a> () const</li>
50<li class=fn>void <a href="#setDirection"><b>setDirection</b></a> ( Direction&nbsp;direction )</li>
51<li class=fn>void <a href="#addSpacing"><b>addSpacing</b></a> ( int&nbsp;size )</li>
52<li class=fn>void <a href="#addStretch"><b>addStretch</b></a> ( int&nbsp;stretch = 0 )</li>
53<li class=fn>void <a href="#addWidget"><b>addWidget</b></a> ( QWidget&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )</li>
54<li class=fn>void <a href="#addLayout"><b>addLayout</b></a> ( QLayout&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )</li>
55<li class=fn>void <a href="#addStrut"><b>addStrut</b></a> ( int&nbsp;size )</li>
56<li class=fn>void <a href="#insertSpacing"><b>insertSpacing</b></a> ( int&nbsp;index, int&nbsp;size )</li>
57<li class=fn>void <a href="#insertStretch"><b>insertStretch</b></a> ( int&nbsp;index, int&nbsp;stretch = 0 )</li>
58<li class=fn>void <a href="#insertWidget"><b>insertWidget</b></a> ( int&nbsp;index, QWidget&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )</li>
59<li class=fn>void <a href="#insertLayout"><b>insertLayout</b></a> ( int&nbsp;index, QLayout&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )</li>
60<li class=fn>bool <a href="#setStretchFactor"><b>setStretchFactor</b></a> ( QWidget&nbsp;*&nbsp;w, int&nbsp;stretch )</li>
61<li class=fn>bool <a href="#setStretchFactor-2"><b>setStretchFactor</b></a> ( QLayout&nbsp;*&nbsp;l, int&nbsp;stretch )</li>
62<li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
63<li class=fn>virtual QSize <a href="#minimumSize"><b>minimumSize</b></a> () const</li>
64<li class=fn>virtual QSize <a href="#maximumSize"><b>maximumSize</b></a> () const</li>
65<li class=fn>virtual bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</li>
66<li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int&nbsp;w ) const</li>
67<li class=fn>virtual QSizePolicy::ExpandData <a href="#expanding"><b>expanding</b></a> () const</li>
68<li class=fn>virtual void <a href="#invalidate"><b>invalidate</b></a> ()</li>
69<li class=fn>virtual void <a href="#setGeometry"><b>setGeometry</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
70<li class=fn>int <a href="#findWidget"><b>findWidget</b></a> ( QWidget&nbsp;*&nbsp;w )</li>
71</ul>
72<h2>Protected Members</h2>
73<ul>
74<li class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( int&nbsp;index, QLayoutItem&nbsp;*&nbsp;item )</li>
75</ul>
76<hr><a name="details"></a><h2>Detailed Description</h2>
77
78
79<p> The QBoxLayout class lines up child widgets horizontally or
80vertically.
81<p>
82
83<p> QBoxLayout takes the space it gets (from its parent layout or from
84the <a href="qlayout.html#mainWidget">mainWidget</a>()), divides it up into a row of boxes, and makes
85each managed widget fill one box.
86<p> <center><img src="qhbox-m.png" alt="Horizontal box with five child widgets"></center>
87<p> If the QBoxLayout's orientation is <a href="qt.html#Orientation-enum">Horizontal</a> the boxes are
88placed in a row, with suitable sizes. Each widget (or other box)
89will get at least its minimum size and at most its maximum size.
90Any excess space is shared according to the stretch factors (more
91about that below).
92<p> <center><img src="qvbox-m.png" alt="Vertical box with five child widgets"></center>
93<p> If the QBoxLayout's orientation is <a href="qt.html#Orientation-enum">Vertical</a>, the boxes are
94placed in a column, again with suitable sizes.
95<p> The easiest way to create a QBoxLayout is to use one of the
96convenience classes, e.g. <a href="qhboxlayout.html">QHBoxLayout</a> (for <a href="qt.html#Orientation-enum">Horizontal</a> boxes) or
97<a href="qvboxlayout.html">QVBoxLayout</a> (for <a href="qt.html#Orientation-enum">Vertical</a> boxes). You can also use the
98QBoxLayout constructor directly, specifying its direction as <a href="#Direction-enum">LeftToRight</a>, <a href="#Direction-enum">Down</a>, <a href="#Direction-enum">RightToLeft</a> or <a href="#Direction-enum">Up</a>.
99<p> If the QBoxLayout is not the top-level layout (i.e. it is not
100managing all of the widget's area and children), you must add it
101to its parent layout before you can do anything with it. The
102normal way to add a layout is by calling
103parentLayout-&gt;addLayout().
104<p> Once you have done this, you can add boxes to the QBoxLayout using
105one of four functions:
106<p> <ul>
107<li> <a href="#addWidget">addWidget</a>() to add a widget to the QBoxLayout and set the
108widget's <a href="layout.html#stretch-factor">stretch factor</a>. (The stretch factor is along the row of
109boxes.)
110<p> <li> <a href="#addSpacing">addSpacing</a>() to create an empty box; this is one of the
111functions you use to create nice and spacious dialogs. See below
112for ways to set margins.
113<p> <li> <a href="#addStretch">addStretch</a>() to create an empty, stretchable box.
114<p> <li> <a href="#addLayout">addLayout</a>() to add a box containing another <a href="qlayout.html">QLayout</a> to the row
115and set that layout's stretch factor.
116</ul>
117<p> Use <a href="#insertWidget">insertWidget</a>(), <a href="#insertSpacing">insertSpacing</a>(), <a href="#insertStretch">insertStretch</a>() or
118<a href="#insertLayout">insertLayout</a>() to insert a box at a specified position in the
119layout.
120<p> QBoxLayout also includes two margin widths:
121<p> <ul>
122<li> <a href="qlayout.html#setMargin">setMargin</a>() sets the width of the outer border. This is the width
123of the reserved space along each of the QBoxLayout's four sides.
124<li> <a href="qlayout.html#setSpacing">setSpacing</a>() sets the width between neighboring boxes. (You
125can use <a href="#addSpacing">addSpacing</a>() to get more space at a particular spot.)
126</ul>
127<p> The margin defaults to 0. The spacing defaults to the same as the
128margin width for a top-level layout, or to the same as the parent
129layout. Both are parameters to the constructor.
130<p> To remove a widget from a layout, call <a href="qlayout.html#remove">remove</a>(). Calling
131<a href="qwidget.html#hide">QWidget::hide</a>() on a widget also effectively removes the widget
132from the layout until <a href="qwidget.html#show">QWidget::show</a>() is called.
133<p> You will almost always want to use <a href="qvboxlayout.html">QVBoxLayout</a> and <a href="qhboxlayout.html">QHBoxLayout</a>
134rather than QBoxLayout because of their convenient constructors.
135<p> <p>See also <a href="qgrid.html">QGrid</a>, <a href="layout.html">Layout Overview</a>, <a href="appearance.html">Widget Appearance and Style</a>, and <a href="geomanagement.html">Layout Management</a>.
136
137<hr><h2>Member Type Documentation</h2>
138<h3 class=fn><a name="Direction-enum"></a>QBoxLayout::Direction</h3>
139
140<p> This type is used to determine the direction of a box layout.
141<ul>
142<li><tt>QBoxLayout::LeftToRight</tt> - Horizontal, from left to right
143<li><tt>QBoxLayout::RightToLeft</tt> - Horizontal, from right to left
144<li><tt>QBoxLayout::TopToBottom</tt> - Vertical, from top to bottom
145<li><tt>QBoxLayout::Down</tt> - The same as <a href="#Direction-enum">TopToBottom</a>
146<li><tt>QBoxLayout::BottomToTop</tt> - Vertical, from bottom to top
147<li><tt>QBoxLayout::Up</tt> - The same as <a href="#Direction-enum">BottomToTop</a>
148</ul>
149<hr><h2>Member Function Documentation</h2>
150<h3 class=fn><a name="QBoxLayout"></a>QBoxLayout::QBoxLayout ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;d, int&nbsp;margin = 0, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )
151</h3>
152Constructs a new QBoxLayout with direction <em>d</em> and main widget <em>parent</em>. <em>parent</em> may not be 0.
153<p> The <em>margin</em> is the number of pixels between the edge of the
154widget and its managed children. The <em>spacing</em> is the default
155number of pixels between neighboring children. If <em>spacing</em> is -1
156the value of <em>margin</em> is used for <em>spacing</em>.
157<p> <em>name</em> is the internal object name.
158<p> <p>See also <a href="#direction">direction</a>().
159
160<h3 class=fn><a name="QBoxLayout-2"></a>QBoxLayout::QBoxLayout ( <a href="qlayout.html">QLayout</a>&nbsp;*&nbsp;parentLayout, <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )
161</h3>
162Constructs a new QBoxLayout called <em>name</em>, with direction <em>d</em>,
163and inserts it into <em>parentLayout</em>.
164<p> The <em>spacing</em> is the default number of pixels between neighboring
165children. If <em>spacing</em> is -1, the layout will inherit its
166parent's <a href="qlayout.html#spacing">spacing</a>().
167
168<h3 class=fn><a name="QBoxLayout-3"></a>QBoxLayout::QBoxLayout ( <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )
169</h3>
170Constructs a new QBoxLayout called <em>name</em>, with direction <em>d</em>.
171<p> If <em>spacing</em> is -1, the layout will inherit its parent's
172<a href="qlayout.html#spacing">spacing</a>(); otherwise <em>spacing</em> is used.
173<p> You must insert this box into another layout.
174
175<h3 class=fn><a name="~QBoxLayout"></a>QBoxLayout::~QBoxLayout ()
176</h3>
177Destroys this box layout.
178<p> The layout's widgets aren't destroyed.
179
180<h3 class=fn>void <a name="addItem"></a>QBoxLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a>&nbsp;*&nbsp;item )<tt> [virtual]</tt>
181</h3>
182Adds <em>item</em> to the end of this box layout.
183
184<p>Examples: <a href="tutorial2-09.html#x2629">chart/optionsform.cpp</a> and <a href="tutorial2-08.html#x2593">chart/setdataform.cpp</a>.
185<p>Reimplemented from <a href="qlayout.html#addItem">QLayout</a>.
186<h3 class=fn>void <a name="addLayout"></a>QBoxLayout::addLayout ( <a href="qlayout.html">QLayout</a>&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )
187</h3>
188Adds <em>layout</em> to the end of the box, with serial <a href="layout.html#stretch-factor">stretch factor</a>
189<em>stretch</em>.
190<p> When a layout is constructed with another layout as its parent,
191you don't need to call <a href="#addLayout">addLayout</a>(); the child layout is
192automatically added to the parent layout as it is constructed.
193<p> <p>See also <a href="#insertLayout">insertLayout</a>(), <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#addWidget">addWidget</a>(), and <a href="#addSpacing">addSpacing</a>().
194
195<p>Examples: <a href="tutorial2-09.html#x2630">chart/optionsform.cpp</a>, <a href="tutorial2-08.html#x2594">chart/setdataform.cpp</a>, <a href="simple-font-demo-example.html#x2835">fonts/simple-qfont-demo/viewer.cpp</a>, <a href="listbox-example.html#x1422">listbox/listbox.cpp</a>, <a href="regexptester-example.html#x2469">regexptester/regexptester.cpp</a>, and <a href="tictac-example.html#x19">tictac/tictac.cpp</a>.
196<h3 class=fn>void <a name="addSpacing"></a>QBoxLayout::addSpacing ( int&nbsp;size )
197</h3>
198Adds a non-stretchable space with size <em>size</em> to the end of this
199box layout. QBoxLayout provides default margin and spacing. This
200function adds additional space.
201<p> <p>See also <a href="#insertSpacing">insertSpacing</a>() and <a href="#addStretch">addStretch</a>().
202
203<p>Example: <a href="listbox-example.html#x1423">listbox/listbox.cpp</a>.
204<h3 class=fn>void <a name="addStretch"></a>QBoxLayout::addStretch ( int&nbsp;stretch = 0 )
205</h3>
206Adds a stretchable space with zero minimum size and <a href="layout.html#stretch-factor">stretch factor</a>
207<em>stretch</em> to the end of this box layout.
208<p> <p>See also <a href="#addSpacing">addSpacing</a>().
209
210<p>Examples: <a href="layout-example.html#x528">layout/layout.cpp</a>, <a href="listbox-example.html#x1424">listbox/listbox.cpp</a>, <a href="regexptester-example.html#x2470">regexptester/regexptester.cpp</a>, and <a href="tutorial1-13.html#x2410">t13/gamebrd.cpp</a>.
211<h3 class=fn>void <a name="addStrut"></a>QBoxLayout::addStrut ( int&nbsp;size )
212</h3>
213Limits the perpendicular dimension of the box (e.g. height if the
214box is LeftToRight) to a minimum of <em>size</em>. Other constraints may
215increase the limit.
216
217<h3 class=fn>void <a name="addWidget"></a>QBoxLayout::addWidget ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )
218</h3>
219Adds <em>widget</em> to the end of this box layout, with a <a href="layout.html#stretch-factor">stretch factor</a> of <em>stretch</em> and alignment <em>alignment</em>.
220<p> The stretch factor applies only in the <a href="#direction">direction</a> of the QBoxLayout, and is relative to the other boxes and
221widgets in this QBoxLayout. Widgets and boxes with higher stretch
222factors grow more.
223<p> If the stretch factor is 0 and nothing else in the QBoxLayout has
224a stretch factor greater than zero, the space is distributed
225according to the QWidget:sizePolicy() of each widget that's
226involved.
227<p> Alignment is specified by <em>alignment</em> which is a bitwise OR of <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which means
228that the widget fills the entire cell.
229<p> From Qt 3.0, the <em>alignment</em> parameter is interpreted more
230aggressively than in previous versions of Qt. A non-default
231alignment now indicates that the widget should not grow to fill
232the available space, but should be sized according to <a href="#sizeHint">sizeHint</a>().
233<p> <p>See also <a href="#insertWidget">insertWidget</a>(), <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#addLayout">addLayout</a>(), and <a href="#addSpacing">addSpacing</a>().
234
235<p>Examples: <a href="tutorial2-09.html#x2631">chart/optionsform.cpp</a>, <a href="checklists-example.html#x423">checklists/checklists.cpp</a>, <a href="layout-example.html#x529">layout/layout.cpp</a>, <a href="lineedits-example.html#x169">lineedits/lineedits.cpp</a>, <a href="listbox-example.html#x1425">listbox/listbox.cpp</a>, <a href="tutorial1-13.html#x2411">t13/gamebrd.cpp</a>, and <a href="tutorial1-13.html#x2401">t13/lcdrange.cpp</a>.
236<h3 class=fn><a href="qboxlayout.html#Direction-enum">Direction</a> <a name="direction"></a>QBoxLayout::direction () const
237</h3>
238
239<p> Returns the direction of the box. <a href="#addWidget">addWidget</a>() and <a href="#addSpacing">addSpacing</a>()
240work in this direction; the stretch stretches in this direction.
241<p> <p>See also <a href="#Direction-enum">QBoxLayout::Direction</a>, <a href="#addWidget">addWidget</a>(), and <a href="#addSpacing">addSpacing</a>().
242
243<h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">QSizePolicy::ExpandData</a> <a name="expanding"></a>QBoxLayout::expanding () const<tt> [virtual]</tt>
244</h3>
245Returns whether this layout can make use of more space than
246<a href="#sizeHint">sizeHint</a>(). A value of <a href="qt.html#Orientation-enum">Vertical</a> or <a href="qt.html#Orientation-enum">Horizontal</a> means that it wants
247to grow in only one dimension, whereas <tt>BothDirections</tt> means that
248it wants to grow in both dimensions.
249
250<p>Reimplemented from <a href="qlayout.html#expanding">QLayout</a>.
251<h3 class=fn>int <a name="findWidget"></a>QBoxLayout::findWidget ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w )
252</h3>
253Searches for widget <em>w</em> in this layout (not including child
254layouts).
255<p> Returns the index of <em>w</em>, or -1 if <em>w</em> is not found.
256
257<h3 class=fn>bool <a name="hasHeightForWidth"></a>QBoxLayout::hasHeightForWidth () const<tt> [virtual]</tt>
258</h3>
259Returns TRUE if this layout's preferred height depends on its width;
260otherwise returns FALSE.
261
262<p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem</a>.
263<h3 class=fn>int <a name="heightForWidth"></a>QBoxLayout::heightForWidth ( int&nbsp;w ) const<tt> [virtual]</tt>
264</h3>
265Returns the layout's preferred height when it is <em>w</em> pixels wide.
266
267<p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem</a>.
268<h3 class=fn>void <a name="insertItem"></a>QBoxLayout::insertItem ( int&nbsp;index, <a href="qlayoutitem.html">QLayoutItem</a>&nbsp;*&nbsp;item )<tt> [protected]</tt>
269</h3>
270Inserts <em>item</em> into this box layout at position <em>index</em>. If <em>index</em> is negative, the item is added at the end.
271<p> <b>Warning:</b> Does not call QLayout::insertChildLayout() if <em>item</em> is
272a <a href="qlayout.html">QLayout</a>.
273<p> <p>See also <a href="#addItem">addItem</a>() and <a href="#findWidget">findWidget</a>().
274
275<h3 class=fn>void <a name="insertLayout"></a>QBoxLayout::insertLayout ( int&nbsp;index, <a href="qlayout.html">QLayout</a>&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )
276</h3>
277Inserts <em>layout</em> at position <em>index</em>, with <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em>. If <em>index</em> is negative, the layout is added at the end.
278<p> <em>layout</em> becomes a child of the box layout.
279<p> <p>See also <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#insertWidget">insertWidget</a>(), and <a href="#insertSpacing">insertSpacing</a>().
280
281<h3 class=fn>void <a name="insertSpacing"></a>QBoxLayout::insertSpacing ( int&nbsp;index, int&nbsp;size )
282</h3>
283Inserts a non-stretchable space at position <em>index</em>, with size <em>size</em>. If <em>index</em> is negative the space is added at the end.
284<p> The box layout has default margin and spacing. This function adds
285additional space.
286<p> <p>See also <a href="#insertStretch">insertStretch</a>().
287
288<h3 class=fn>void <a name="insertStretch"></a>QBoxLayout::insertStretch ( int&nbsp;index, int&nbsp;stretch = 0 )
289</h3>
290Inserts a stretchable space at position <em>index</em>, with zero
291minimum size and <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em>. If <em>index</em> is
292negative the space is added at the end.
293<p> <p>See also <a href="#insertSpacing">insertSpacing</a>().
294
295<h3 class=fn>void <a name="insertWidget"></a>QBoxLayout::insertWidget ( int&nbsp;index, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )
296</h3>
297Inserts <em>widget</em> at position <em>index</em>, with <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em> and alignment <em>alignment</em>. If <em>index</em> is negative, the
298widget is added at the end.
299<p> The stretch factor applies only in the <a href="#direction">direction</a> of the QBoxLayout, and is relative to the other boxes and
300widgets in this QBoxLayout. Widgets and boxes with higher stretch
301factors grow more.
302<p> If the stretch factor is 0 and nothing else in the QBoxLayout has
303a stretch factor greater than zero, the space is distributed
304according to the QWidget:sizePolicy() of each widget that's
305involved.
306<p> Alignment is specified by <em>alignment</em>, which is a bitwise OR of
307<a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which
308means that the widget fills the entire cell.
309<p> From Qt 3.0, the <em>alignment</em> parameter is interpreted more
310aggressively than in previous versions of Qt. A non-default
311alignment now indicates that the widget should not grow to fill
312the available space, but should be sized according to <a href="#sizeHint">sizeHint</a>().
313<p> <p>See also <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#insertLayout">insertLayout</a>(), and <a href="#insertSpacing">insertSpacing</a>().
314
315<h3 class=fn>void <a name="invalidate"></a>QBoxLayout::invalidate ()<tt> [virtual]</tt>
316</h3>
317Resets cached information.
318
319<p>Reimplemented from <a href="qlayout.html#invalidate">QLayout</a>.
320<h3 class=fn><a href="qsize.html">QSize</a> <a name="maximumSize"></a>QBoxLayout::maximumSize () const<tt> [virtual]</tt>
321</h3>
322Returns the maximum size needed by this box layout.
323
324<p>Reimplemented from <a href="qlayout.html#maximumSize">QLayout</a>.
325<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSize"></a>QBoxLayout::minimumSize () const<tt> [virtual]</tt>
326</h3>
327Returns the minimum size needed by this box layout.
328
329<p>Reimplemented from <a href="qlayout.html#minimumSize">QLayout</a>.
330<h3 class=fn>void <a name="setDirection"></a>QBoxLayout::setDirection ( <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;direction )
331</h3>
332Sets the direction of this layout to <em>direction</em>.
333
334<h3 class=fn>void <a name="setGeometry"></a>QBoxLayout::setGeometry ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )<tt> [virtual]</tt>
335</h3>
336Resizes managed widgets within the rectangle <em>r</em>.
337
338<p>Reimplemented from <a href="qlayout.html#setGeometry">QLayout</a>.
339<h3 class=fn>bool <a name="setStretchFactor"></a>QBoxLayout::setStretchFactor ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w, int&nbsp;stretch )
340</h3>
341Sets the <a href="layout.html#stretch-factor">stretch factor</a> for widget <em>w</em> to <em>stretch</em> and returns
342TRUE if <em>w</em> is found in this layout (not including child
343layouts); otherwise returns FALSE.
344
345<h3 class=fn>bool <a name="setStretchFactor-2"></a>QBoxLayout::setStretchFactor ( <a href="qlayout.html">QLayout</a>&nbsp;*&nbsp;l, int&nbsp;stretch )
346</h3>
347This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
348<p> Sets the <a href="layout.html#stretch-factor">stretch factor</a> for the layout <em>l</em> to <em>stretch</em> and
349returns TRUE if <em>l</em> is found in this layout (not including child
350layouts); otherwise returns FALSE.
351
352<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QBoxLayout::sizeHint () const<tt> [virtual]</tt>
353</h3>
354Returns the preferred size of this box layout.
355
356<p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem</a>.
357<!-- eof -->
358<hr><p>
359This file is part of the <a href="index.html">Qt toolkit</a>.
360Copyright &copy; 1995-2007
361<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
362<table width=100% cellspacing=0 border=0><tr>
363<td>Copyright &copy; 2007
364<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
365<td align=right><div align=right>Qt 3.3.8</div>
366</table></div></address></body>
367</html>
Note: See TracBrowser for help on using the repository browser.