- Extending Qt Creator Manual
- Layouting Namespace
- Extending Qt Creator Manual 21.0.0-beta1

# Layouting Namespace

The Layouting namespace contains classes and functions to conveniently create layouts in code. More...

Header: | `#include <Layouting>`

## Functions

Q_DECL_IMPORT | addToWidget(Layouting::Widget *widget, const Layouting::Layout &layout)
Q_DECL_IMPORT | br(Layouting::Layout *layout)
Q_DECL_IMPORT | destroyLayout(QLayout *layout)
Q_DECL_IMPORT | empty(Layouting::Layout *layout)
Q_DECL_IMPORT | hr(Layouting::Layout *layout)
Q_DECL_IMPORT | ignoreDirtyHooks(Layouting::Widget *widget)
Q_DECL_IMPORT | noMargin(Layouting::Layout *layout)
Q_DECL_IMPORT | normalMargin(Layouting::Layout *layout)
Q_DECL_IMPORT | st(Layouting::Layout *layout)
Q_DECL_IMPORT | tight(Layouting::Layout *layout)
Q_DECL_IMPORT | withFormAlignment(Layouting::Layout *layout)

## Detailed Description

Classes in the namespace help to create QLayout or QWidget derived classes. Instances should be used locally within a function and never stored.

See also Layouting::Widget and Layouting::Layout.

## Function Documentation

### Q_DECL_IMPORT Layouting::addToWidget(Layouting::Widget *widget, const Layouting::Layout &layout)

Starts a new row containing items. The row can be further extended by other items using `addItem()` or `addItems()`.

See also addItem() and addItems().

### Q_DECL_IMPORT Layouting::br(Layouting::Layout *layout)

Starts a new row in layout by calling flush(). Use in Grid and Form initializer lists to end the current row.

See also Layout::flush() and Layout::addRow().

### Q_DECL_IMPORT Layouting::destroyLayout(QLayout *layout)

Recursively destroys layout and all its child items and nested layouts. Widgets owned by the layout items are also deleted.

### Q_DECL_IMPORT Layouting::empty(Layouting::Layout *layout)

Adds an empty (no-op) placeholder item to layout. Useful as a filler in Grid or Form rows where a cell should be left blank.

### Q_DECL_IMPORT Layouting::hr(Layouting::Layout *layout)

Adds a horizontal rule (a sunken QFrame) to layout.

See also Layouting::createHr().

### Q_DECL_IMPORT Layouting::ignoreDirtyHooks(Layouting::Widget *widget)

Marks widget so that changes to it do not trigger dirty-state notifications. Useful for widgets whose value changes should not mark a settings page or document as modified.

### Q_DECL_IMPORT Layouting::noMargin(Layouting::Layout *layout)

Sets all content margins of layout to zero.

See also Layout::setNoMargins(), Layouting::normalMargin(), and Layouting::tight().

### Q_DECL_IMPORT Layouting::normalMargin(Layouting::Layout *layout)

Sets all content margins of layout to 9 pixels.

See also Layout::setNormalMargins() and Layouting::noMargin().

### Q_DECL_IMPORT Layouting::st(Layouting::Layout *layout)

Adds a stretch factor of 1 to layout. Only effective in box (Column/Row) layouts.

See also Layouting::Stretch and Layouting::spacing().

### Q_DECL_IMPORT Layouting::tight(Layouting::Layout *layout)

Sets both the content margins and the spacing of layout to zero. Equivalent to calling noMargin() followed by spacing(0).

See also Layouting::noMargin() and Layouting::spacing().

### Q_DECL_IMPORT Layouting::withFormAlignment(Layouting::Layout *layout)

Intended to enable form-style label alignment for layout. Not yet implemented.