Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QLayout

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QLayout class reference

### Public Functions

- QLayout ( QWidget * parent, int margin, int spacing = -1, const char * name = 0 )
- QLayout ( QLayout * parentLayout, int spacing, const char * name = 0 )
- QLayout ( int spacing, const char * name = 0 )
- void add ( QWidget * w )
- bool autoAdd () const
- int defaultBorder () const
- QLayoutIterator iterator ()
- QWidget * mainWidget () const
- void remove ( QWidget * w )
- void setAutoAdd ( bool a )

## Member Function Documentation

### QLayout::QLayout ( QWidget * parent, int margin, int spacing = -1, const char * name = 0 )

Constructs a new top-level QLayout called name, with parent widget parent. parent may not be 0.

The margin is the number of pixels between the edge of the widget and the managed children. The spacing sets the value of spacing(), which gives the spacing between the managed widgets. If spacing is -1 (the default), spacing is set to the value of margin.

There can be only one top-level layout for a widget. It is returned by QWidget::layout()

### QLayout::QLayout ( QLayout * parentLayout, int spacing, const char * name = 0 )

Constructs a new child QLayout called name, and places it inside parentLayout by using the default placement defined by addItem().

If spacing is -1, this QLayout inherits parentLayout's spacing(), otherwise the value of spacing is used.

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

Constructs a new child QLayout called name. If spacing is -1, this QLayout inherits its parent's spacing(); otherwise the value of spacing is used.

This layout has to be inserted into another layout before geometry management will work.

### void QLayout::add ( QWidget * w )

Use addWidget() instead.

### bool QLayout::autoAdd () const

Automatically adding widgets is deprecated. Use addWidget() or addLayout() instead.

### int QLayout::defaultBorder () const

Use spacing() instead.

### QLayoutIterator QLayout::iterator ()

Use a QLayoutIterator() constructor instead.

### QWidget * QLayout::mainWidget () const

Use parentWidget() instead.

### void QLayout::remove ( QWidget * w )

Use removeWidget() instead.

### void QLayout::setAutoAdd ( bool a )

Automatically adding widgets is deprecated. Use addWidget() or addLayout() instead.