- 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>`

## Classes

class | Align
class | Canvas
class | CanvasWidget
class | Column
class | CompletingTextEdit
class | Else
class | Flow
class | Form
class | Grid
class | GridCell
class | Group
class | If
class | Label
class | Layout
class | LayoutItem
class | LineEdit
class | MarkdownBrowser
class | PushButton
class | Row
class | ScrollArea
class | Space
class | Span
class | SpanAll
class | SpinBox
class | Spinner
class | Splitter
class | Stack
class | Stretch
class | Tab
class | TabWidget
class | TextEdit
class | Then
class | ToolBar
class | ToolButton
class | Widget

## Functions

void | br(Layouting::Layout *layout)
QWidget * | createHr(QWidget *parent = nullptr)
void | destroyLayout(QLayout *layout)
void | empty(Layouting::Layout *layout)
void | hr(Layouting::Layout *layout)
void | ignoreDirtyHooks(Layouting::Widget *widget)
void | noMargin(Layouting::Layout *layout)
void | normalMargin(Layouting::Layout *layout)
Layouting::LayoutModifier | spacing(int space)
void | st(Layouting::Layout *layout)
Layouting::LayoutModifier | stretch(int index, int stretch)
void | tight(Layouting::Layout *layout)
void | 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.

## Classes

### class Align

Sets a Qt::Alignment on all items produced by the wrapped builder. More...

### class Canvas

Provides a custom-painted widget surface for use in a Layouting builder. More...

### class CanvasWidget

A QWidget subclass that delegates painting to a user-supplied function. More...

### class Column

Arranges items vertically (QVBoxLayout). More...

### class CompletingTextEdit

Wraps Utils::CompletingTextEdit for use in a Layouting builder. More...

### class Else

Holds the list of items to include when the If condition is false. More...

### class Flow

Arranges items in a left-to-right flow that wraps to a new line when the available width is exceeded. More...

### class Form

Arranges label-field pairs in a two-column form layout (QFormLayout). More...

### class Grid

Arranges items in a two-dimensional grid (QGridLayout). More...

### class GridCell

Groups multiple items into a single grid cell without advancing the column counter. More...

### class Group

Wraps QGroupBox for use in a Layouting builder. More...

### class If

Conditionally includes layout items based on a boolean condition. More...

### class Label

Wraps QLabel for use in a Layouting builder. More...

### class Layout

Base class for layout builder classes. More...

### class LayoutItem

### class LineEdit

Wraps Utils::FancyLineEdit for use in a Layouting builder. More...

### class MarkdownBrowser

Wraps Utils::MarkdownBrowser for use in a Layouting builder. More...

### class PushButton

Wraps QPushButton for use in a Layouting builder. More...

### class Row

Arranges items horizontally (QHBoxLayout). More...

### class ScrollArea

Wraps QScrollArea for use in a Layouting builder. More...

### class Space

The Space class represents some empty space in a layout. More...

### class Span

Sets a column and/or row span on a single item in a Grid layout. More...

### class SpanAll

Sets a column and/or row span on all items added by a nested builder. More...

### class SpinBox

Wraps QSpinBox for use in a Layouting builder. More...

### class Spinner

Wraps SpinnerSolution::SpinnerWidget for use in a Layouting builder. More...

### class Splitter

Wraps QSplitter for use in a Layouting builder. More...

### class Stack

Wraps QStackedWidget for use in a Layouting builder. More...

### class Stretch

The Stretch class represents some stretch in a layout. More...

### class Tab

Represents a single tab for use inside a TabWidget builder. More...

### class TabWidget

Wraps QTabWidget for use in a Layouting builder. More...

### class TextEdit

Wraps QTextEdit for use in a Layouting builder. More...

### class Then

Holds the list of items to include when the If condition is true. More...

### class ToolBar

Wraps QToolBar for use in a Layouting builder. More...

### class ToolButton

Wraps QToolButton for use in a Layouting builder. More...

### class Widget

Base class for widget builder classes. More...

## Function Documentation

### void 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().

### QWidget *Layouting::createHr(QWidget *parent = nullptr)

Creates and returns a horizontal rule widget (a sunken QFrame with a HLine shape). The optional parent is passed to the QFrame constructor.

See also Layouting::hr().

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

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

### void 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.

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

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

See also Layouting::createHr().

### void 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.

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

Sets all content margins of layout to zero.

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

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

Sets all content margins of layout to 9 pixels.

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

### Layouting::LayoutModifier Layouting::spacing(int space)

Returns a LayoutModifier that sets the spacing of a layout to space pixels.

See also Layouting::stretch().

### void 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().

### Layouting::LayoutModifier Layouting::stretch(int index, int stretch)

Returns a LayoutModifier that sets the stretch factor of item at index to stretch.

See also Layouting::spacing().

### void 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().

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

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