![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QLayout class is the base class of geometry specifiers. More...
#include <qabstractlayout.h>
Inherits QObject and QLayoutItem.
Inherited by QGridLayout and QBoxLayout.
This is an abstract base class. The concrete layout managers QBoxLayout and QGridLayout inherit from this one.
For users of QLayout subclasses or of QMainWindow there is seldom need to use any of the basic functions provided by QLayout, such as resizeMode or setMenuBar(). See the layout overview page for more information.
To make your own layout manager, make a subclass of QGLayoutIterator and implement the functions addItem(), sizeHint(), setGeometry(), and iterator(). You should also implement minimumSize(); otherwise your layout will be resized to zero size if there is too little space. To support children whose height depend on their widths, implement hasHeightForWidth() and heightForWidth(). See the custom layout page for an in-depth description.
Geometry management stops when the layout manager is deleted.
The possible values are:
border is the number of pixels between the edge of the widget and the managed children. space sets the value of spacing(), which gives the spacing between widgets. The default value for space is -1, which means that the value of border is used.
name is the internal object name
There can be only one top-level layout for a widget. It is returned by QWidget::layout()
If space is -1, this QLayout inherits parentLayout's spacing(), otherwise space is used.
This layout has to be inserted into another layout before geometry management will work.
However, if you set up a QLayout for a visible widget without resizing that widget, you need to call this function in order to lay it out.
See also QWidget::updateGeometry().
Examples: layout/layout.cpp, popup/popup.cpp, scrollview/scrollview.cpp, sql/overview/form1/main.cpp and validator/vw.cpp.
Adds w to this layout in a manner specific to the layout. This function uses addItem.
Examples: customlayout/border.cpp and customlayout/main.cpp.
Note that the ownership of item is transferred to the layout, and it is the layout's responsibility to delete it.
Examples: customlayout/border.cpp, customlayout/card.cpp and customlayout/flow.cpp.
Reimplemented in QGridLayout and QBoxLayout.
The result is calculated from sizeHint() and expanding(). It is never larger than r.
autoAdd() is disabled by default.
See also setAutoAdd().
Reimplemented from QObject.
The default implementation returns BothDirections.
Examples: customlayout/border.cpp and customlayout/flow.cpp.
Reimplemented from QLayoutItem.
Reimplemented in QGridLayout and QBoxLayout.
Reimplemented from QLayoutItem.
Reimplemented in QGridLayout and QBoxLayout.
Reimplemented from QLayoutItem.
See also setEnabled().
Returns TRUE if this layout is a top-level layout, i.e., not a child of another layout.
A typical implementation will be:
QLayoutIterator MyLayout::iterator() { QGLayoutIterator *i = new MyLayoutIterator( internal_data ); return QLayoutIterator( i ); }where MyLayoutIterator is a subclass of QGLayoutIterator.
Examples: customlayout/border.cpp, customlayout/card.cpp and customlayout/flow.cpp.
Reimplemented from QLayoutItem.
Returns the width of the outside border of the layout. See the "margin" property for details.
The default implementation allows unlimited resizing.
Reimplemented from QLayoutItem.
Reimplemented in QGridLayout and QBoxLayout.
The default implementation allows unlimited resizing.
Examples: customlayout/border.cpp, customlayout/card.cpp and customlayout/flow.cpp.
Reimplemented from QLayoutItem.
Reimplemented in QGridLayout and QBoxLayout.
Returns the resize mode of the layout. See the "resizeMode" property for details.
See also autoAdd().
Example: i18n/main.cpp.
An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.
By default all layouts are enabled.
See also isEnabled().
The default implementation maintains the geometry() information. Reimplementors must call this function.
Examples: customlayout/border.cpp, customlayout/card.cpp and customlayout/flow.cpp.
Reimplemented from QLayoutItem.
Reimplemented in QGridLayout and QBoxLayout.
Sets the width of the outside border of the layout. See the "margin" property for details.
A menu bar does its own geometry managing, never do addWidget() on a QMenuBar.
Examples: layout/layout.cpp and scrollview/scrollview.cpp.
Sets the resize mode of the layout. See the "resizeMode" property for details.
Sets the spacing between widgets inside the layout. See the "spacing" property for details.
If b is TRUE, margin handling needs to be implemented in setGeometry(), maximumSize(), minimumSize(), sizeHint() and heightForWidth().
See also supportsMargin().
Returns the spacing between widgets inside the layout. See the "spacing" property for details.
Returns TRUE if this layout supports QLayout::margin on non-top-level layouts.
See also margin.
This property holds the width of the outside border of the layout.
For some layout classes this property has an effect only on top-level layouts; QBoxLayout and QGridLayout support margins for child layouts.
For some layout classes this propety has an effect only on top-level layouts; QBoxLayout and QGridLayout support margins for child layouts.
Set this property's value with setMargin() and get this property's value with margin().
See also spacing.
This property holds the resize mode of the layout.
The default mode is Minimum for top-level widgets and FreeResize for all others.
Set this property's value with setResizeMode() and get this property's value with resizeMode().
See also QLayout::ResizeMode.
This property holds the spacing between widgets inside the layout.
Set this property's value with setSpacing() and get this property's value with spacing().
See also margin.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|