1QLayout(3qt)                                                      QLayout(3qt)
2
3
4

NAME

6       QLayout - The base class of geometry managers
7

SYNOPSIS

9       #include <qlayout.h>
10
11       Inherits QObject and QLayoutItem.
12
13       Inherited by QGridLayout and QBoxLayout.
14
15   Public Members
16       enum ResizeMode { FreeResize, Minimum, Fixed, Auto }
17       QLayout ( QWidget * parent, int margin = 0, int spacing = -1, const
18           char * name = 0 )
19       QLayout ( QLayout * parentLayout, int spacing = -1, const char * name =
20           0 )
21       QLayout ( int spacing = -1, const char * name = 0 )
22       int margin () const
23       int spacing () const
24       virtual void setMargin ( int )
25       virtual void setSpacing ( int )
26       void setResizeMode ( ResizeMode )
27       ResizeMode resizeMode () const
28       virtual void setMenuBar ( QMenuBar * w )
29       QMenuBar * menuBar () const
30       QWidget * mainWidget ()
31       bool isTopLevel () const
32       virtual void setAutoAdd ( bool b )
33       bool autoAdd () const
34       virtual void invalidate ()
35       bool activate ()
36       void add ( QWidget * w )
37       virtual void addItem ( QLayoutItem * item ) = 0
38       void remove ( QWidget * widget )
39       void removeItem ( QLayoutItem * item )
40       virtual QSizePolicy::ExpandData expanding () const
41       virtual QSize minimumSize () const
42       virtual QSize maximumSize () const
43       virtual void setGeometry ( const QRect & r ) = 0
44       virtual QLayoutIterator iterator () = 0
45       virtual bool isEmpty () const
46       bool supportsMargin () const
47       void setEnabled ( bool enable )
48       bool isEnabled () const
49
50   Properties
51       int margin - the width of the outside border of the layout
52       ResizeMode resizeMode - the resize mode of the layout
53       int spacing - the spacing between widgets inside the layout
54
55   Protected Members
56       void addChildLayout ( QLayout * l )
57       void deleteAllItems ()
58       void setSupportsMargin ( bool b )
59       QRect alignmentRect ( const QRect & r ) const
60

DESCRIPTION

62       The QLayout class is the base class of geometry managers.
63
64       This is an abstract base class inherited by the concrete classes,
65       QBoxLayout and QGridLayout.
66
67       For users of QLayout subclasses or of QMainWindow there is seldom any
68       need to use the basic functions provided by QLayout, such as
69       setResizeMode() or setMenuBar(). See the layout overview page for more
70       information.
71
72       To make your own layout manager, subclass QGLayoutIterator and
73       implement the functions addItem(), sizeHint(), setGeometry(), and
74       iterator(). You should also implement minimumSize() to ensure your
75       layout isn't resized to zero size if there is too little space. To
76       support children whose heights depend on their widths, implement
77       hasHeightForWidth() and heightForWidth(). See the custom layout page
78       for an in-depth description.
79
80       Geometry management stops when the layout manager is deleted.
81
82       See also Widget Appearance and Style and Layout Management.
83
84   Member Type Documentation

QLayout::ResizeMode

86       The possible values are:
87
88       QLayout::Auto - If the main widget is a top-level widget with no
89       height-for-width (hasHeightForWidth()), this is the same as Minimium;
90       otherwise, this is the same as FreeResize.
91
92       QLayout::Fixed - The main widget's size is set to sizeHint(); it cannot
93       be resized at all.
94
95       QLayout::Minimum - The main widget's minimum size is set to
96       minimumSize(); it cannot be smaller.
97
98       QLayout::FreeResize - The widget is not constrained.
99

MEMBER FUNCTION DOCUMENTATION

QLayout::QLayout ( QWidget * parent, int margin = 0, int spacing = -1, const

102       char * name = 0 )
103       Constructs a new top-level QLayout called name, with main widget
104       parent. parent may not be 0.
105
106       The margin is the number of pixels between the edge of the widget and
107       the managed children. The spacing sets the value of spacing(), which
108       gives the spacing between the managed widgets. If spacing is -1 (the
109       default), spacing is set to the value of margin.
110
111       There can be only one top-level layout for a widget. It is returned by
112       QWidget::layout()
113

QLayout::QLayout ( QLayout * parentLayout, int spacing = -1, const char * name

115       = 0 )
116       Constructs a new child QLayout called name, and places it inside
117       parentLayout by using the default placement defined by addItem().
118
119       If spacing is -1, this QLayout inherits parentLayout's spacing(),
120       otherwise the value of spacing is used.
121

QLayout::QLayout ( int spacing = -1, const char * name = 0 )

123       Constructs a new child QLayout called name. If spacing is -1, this
124       QLayout inherits its parent's spacing(); otherwise the value of spacing
125       is used.
126
127       This layout has to be inserted into another layout before geometry
128       management will work.
129

bool QLayout::activate ()

131       Redoes the layout for mainWidget(). You should generally not need to
132       call this because it is automatically called at the most appropriate
133       times.
134
135       However, if you set up a QLayout for a visible widget without resizing
136       that widget, you will need to call this function in order to lay it
137       out.
138
139       See also QWidget::updateGeometry().
140
141       Examples:
142

void QLayout::add ( QWidget * w )

144       Adds widget w to this layout in a manner specific to the layout. This
145       function uses addItem().
146
147       Examples:
148

void QLayout::addChildLayout ( QLayout * l ) [protected]

150       This function is called from addLayout() functions in subclasses to add
151       layout l as a sub-layout.
152

void QLayout::addItem ( QLayoutItem * item ) [pure virtual]

154       Implemented in subclasses to add an item. How it is added is specific
155       to each subclass.
156
157       The ownership of item is transferred to the layout, and it's the
158       layout's responsibility to delete it.
159
160       Examples:
161
162       Reimplemented in QGridLayout and QBoxLayout.
163

QRect QLayout::alignmentRect ( const QRect & r ) const [protected]

165       Returns the rectangle that should be covered when the geometry of this
166       layout is set to r, provided that this layout supports setAlignment().
167
168       The result is derived from sizeHint() and expanding(). It is never
169       larger than r.
170

bool QLayout::autoAdd () const

172       Returns TRUE if this layout automatically grabs all new mainWidget()'s
173       new children and adds them as defined by addItem(); otherwise returns
174       FALSE. This has effect only for top-level layouts, i.e. layouts that
175       are direct children of their mainWidget().
176
177       autoAdd() is disabled by default.
178
179       Note that a top-level layout is not necessarily associated with the
180       top-level widget.
181
182       See also setAutoAdd().
183

void QLayout::deleteAllItems () [protected]

185       Removes and deletes all items in this layout.
186

QSizePolicy::ExpandData QLayout::expanding () const [virtual]

188       Returns whether this layout can make use of more space than sizeHint().
189       A value of Vertical or Horizontal means that it wants to grow in only
190       one dimension, whereas BothDirections means that it wants to grow in
191       both dimensions.
192
193       The default implementation returns BothDirections.
194
195       Examples:
196
197       Reimplemented from QLayoutItem.
198
199       Reimplemented in QGridLayout and QBoxLayout.
200

void QLayout::invalidate () [virtual]

202       Invalidates cached information. Reimplementations must call this.
203
204       Reimplemented from QLayoutItem.
205
206       Reimplemented in QGridLayout and QBoxLayout.
207

bool QLayout::isEmpty () const [virtual]

209       Returns TRUE if this layout is empty. The default implementation
210       returns FALSE.
211
212       Reimplemented from QLayoutItem.
213

bool QLayout::isEnabled () const

215       Returns TRUE if the layout is enabled; otherwise returns FALSE.
216
217       See also setEnabled().
218

bool QLayout::isTopLevel () const

220       Returns TRUE if this layout is a top-level layout, i.e. not a child of
221       another layout; otherwise returns FALSE.
222

QLayoutIterator QLayout::iterator () [pure virtual]

224       Implemented in subclasses to return an iterator that iterates over this
225       layout's children.
226
227       A typical implementation will be:
228
229               QLayoutIterator MyLayout::iterator()
230               {
231                   QGLayoutIterator *i = new MyLayoutIterator( internal_data );
232                   return QLayoutIterator( i );
233               }
234       where MyLayoutIterator is a subclass of QGLayoutIterator.
235
236       Examples:
237
238       Reimplemented from QLayoutItem.
239

QWidget * QLayout::mainWidget ()

241       Returns the main widget (parent widget) of this layout, or 0 if this
242       layout is a sub-layout that is not yet inserted.
243

int QLayout::margin () const

245       Returns the width of the outside border of the layout. See the "margin"
246       property for details.
247

QSize QLayout::maximumSize () const [virtual]

249       Returns the maximum size of this layout. This is the largest size that
250       the layout can have while still respecting the specifications. Does not
251       include what's needed by margin() or menuBar().
252
253       The default implementation allows unlimited resizing.
254
255       Reimplemented from QLayoutItem.
256
257       Reimplemented in QGridLayout and QBoxLayout.
258

QMenuBar * QLayout::menuBar () const

260       Returns the menu bar set for this layout, or 0 if no menu bar is set.
261

QSize QLayout::minimumSize () const [virtual]

263       Returns the minimum size of this layout. This is the smallest size that
264       the layout can have while still respecting the specifications. Does not
265       include what's needed by margin() or menuBar().
266
267       The default implementation allows unlimited resizing.
268
269       Examples:
270
271       Reimplemented from QLayoutItem.
272
273       Reimplemented in QGridLayout and QBoxLayout.
274

void QLayout::remove ( QWidget * widget )

276       Removes the widget widget from the layout. After this call, it is the
277       caller's responsibility to give the widget a reasonable geometry or to
278       put the widget back into a layout.
279
280       See also removeItem(), QWidget::geometry, and add().
281

void QLayout::removeItem ( QLayoutItem * item )

283       Removes the layout item item from the layout. It is the caller's
284       responsibility to delete the item.
285
286       Notice that item can be a layout (since QLayout inherits QLayoutItem).
287
288       See also remove() and addItem().
289

ResizeMode QLayout::resizeMode () const

291       Returns the resize mode of the layout. See the "resizeMode" property
292       for details.
293

void QLayout::setAutoAdd ( bool b ) [virtual]

295       If b is TRUE, auto-add is enabled; otherwise auto-add is disabled.
296
297       Warning: If auto-add is enabled, you cannot set stretch factors on the
298       child widgets until the widgets are actually inserted in the layout
299       (after control returned to the event loop). We therefore recommend that
300       you avoid the auto-add feature in new programs.
301
302       See also autoAdd().
303
304       Examples:
305

void QLayout::setEnabled ( bool enable )

307       Enables this layout if enable is TRUE, otherwise disables it.
308
309       An enabled layout adjusts dynamically to changes; a disabled layout
310       acts as if it did not exist.
311
312       By default all layouts are enabled.
313
314       See also isEnabled().
315

void QLayout::setGeometry ( const QRect & r ) [pure virtual]

317       This function is reimplemented in subclasses to perform layout.
318
319       The default implementation maintains the geometry() information given
320       by rect r. Reimplementors must call this function.
321
322       Examples:
323
324       Reimplemented from QLayoutItem.
325
326       Reimplemented in QGridLayout and QBoxLayout.
327

void QLayout::setMargin ( int ) [virtual]

329       Sets the width of the outside border of the layout. See the "margin"
330       property for details.
331

void QLayout::setMenuBar ( QMenuBar * w ) [virtual]

333       Makes the geometry manager take account of the menu bar w. All child
334       widgets are placed below the bottom edge of the menu bar.
335
336       A menu bar does its own geometry management: never do addWidget() on a
337       QMenuBar.
338
339       Examples:
340

void QLayout::setResizeMode ( ResizeMode )

342       Sets the resize mode of the layout. See the "resizeMode" property for
343       details.
344

void QLayout::setSpacing ( int ) [virtual]

346       Sets the spacing between widgets inside the layout. See the "spacing"
347       property for details.
348

void QLayout::setSupportsMargin ( bool b ) [protected]

350       Sets the value returned by supportsMargin(). If b is TRUE, margin()
351       handling is implemented by the subclass. If b is FALSE (the default),
352       QLayout will add margin() around top-level layouts.
353
354       If b is TRUE, margin handling needs to be implemented in setGeometry(),
355       maximumSize(), minimumSize(), sizeHint() and heightForWidth().
356
357       See also supportsMargin().
358

int QLayout::spacing () const

360       Returns the spacing between widgets inside the layout. See the
361       "spacing" property for details.
362

bool QLayout::supportsMargin () const

364       Returns TRUE if this layout supports QLayout::margin on non-top-level
365       layouts; otherwise returns FALSE.
366
367       See also margin.
368
369   Property Documentation

int margin

371       This property holds the width of the outside border of the layout.
372
373       For some layout classes this property has an effect only on top-level
374       layouts; QBoxLayout and QGridLayout support margins for child layouts.
375       The default value is 0.
376
377       See also spacing.
378
379       Set this property's value with setMargin() and get this property's
380       value with margin().
381

ResizeMode resizeMode

383       This property holds the resize mode of the layout.
384
385       The default mode is Auto.
386
387       See also QLayout::ResizeMode.
388
389       Set this property's value with setResizeMode() and get this property's
390       value with resizeMode().
391

int spacing

393       This property holds the spacing between widgets inside the layout.
394
395       The default value is -1, which signifies that the layout's spacing
396       should not override the widget's spacing.
397
398       See also margin.
399
400       Set this property's value with setSpacing() and get this property's
401       value with spacing().
402
403

SEE ALSO

405       http://doc.trolltech.com/qlayout.html
406       http://www.trolltech.com/faq/tech.html
407
409       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
410       license file included in the distribution for a complete license
411       statement.
412

AUTHOR

414       Generated automatically from the source code.
415

BUGS

417       If you find a bug in Qt, please report it as described in
418       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
419       help you. Thank you.
420
421       The definitive Qt documentation is provided in HTML format; it is
422       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
423       web browser. This man page is provided as a convenience for those users
424       who prefer man pages, although this format is not officially supported
425       by Trolltech.
426
427       If you find errors in this manual page, please report them to qt-
428       bugs@trolltech.com.  Please include the name of the manual page
429       (qlayout.3qt) and the Qt version (3.3.8).
430
431
432
433Trolltech AS                    2 February 2007                   QLayout(3qt)
Impressum