- Qt 5.3
- Qt Quick Layouts
- Layout QML Type
- Qt 5.3.2 Reference Documentation

# Layout QML Type

Provides attached properties for items pushed onto a GridLayout, RowLayout or ColumnLayout. More...

Import Statement: | `import QtQuick.Layouts 1.1`

- List of all members, including inherited members

## Attached Properties

- alignment : Qt.Alignment
- column : int
- columnSpan : int
- fillHeight : bool
- fillWidth : bool
- maximumHeight : real
- maximumWidth : real
- minimumHeight : real
- minimumWidth : real
- preferredHeight : real
- preferredWidth : real
- row : int
- rowSpan : int

## Detailed Description

An object of type Layout is attached to children of the layout to provide layout specific information about the item. The properties of the attached object influences how the layout will arrange the items.

For instance, you can specify minimumWidth, preferredWidth, and maximumWidth if the default values are not satisfactory.

When a layout is resized, items may grow or shrink. Due to this, items have a minimum size, preferred size and a maximum size.

If minimum size have not been explicitly specified on an item, the size is set to `0`. If maximum size have not been explicitly specified on an item, the size is set to `Number.POSITIVE_INFINITY`.

For layouts, the implicit minimum and maximum size depends on the content of the layouts.

The fillWidth and fillHeight properties can either be `true` or `false`. If it is `false`, the item's size will be fixed to its preferred size. Otherwise, it will grow or shrink between its minimum and maximum size as the layout is resized.

Note: It is not recommended to have bindings to the x, y, width, or height properties of items in a layout, since this would conflict with the goal of the Layout, and also cause binding loops.

See also GridLayout, RowLayout, and ColumnLayout.

## Attached Property Documentation

.alignment : Qt.Alignment

This property allows you to specify the alignment of an item within the cell(s) it occupies.

The default value is `0`, which means it will be `Qt.AlignVCenter | Qt.AlignLeft`

A valid alignment is a combination of the following flags:

- Qt::AlignLeft
- Qt::AlignHCenter
- Qt::AlignRight
- Qt::AlignTop
- Qt::AlignVCenter
- Qt::AlignBottom
- Qt::AlignBaseline

.column : int

This property allows you to specify the column position of an item in a GridLayout.

If both row and this property are not set, it is up to the layout to assign a cell to the item.

The default value is `0`.

See also row and columnSpan.

.columnSpan : int

This property allows you to specify the column span of an item in a GridLayout.

The default value is `1`.

See also rowSpan and column.

.fillHeight : bool

If this property is `true`, the item will be as tall as possible while respecting the given constraints. If the property is `false`, the item will have a fixed height set to the preferred height. The default is `false`, except for layouts themselves, which default to `true`.

See also fillWidth.

.fillWidth : bool

If this property is `true`, the item will be as wide as possible while respecting the given constraints. If the property is `false`, the item will have a fixed width set to the preferred width. The default is `false`, except for layouts themselves, which default to `true`.

See also fillHeight.

.maximumHeight : real

The default value is the items implicit maximum height.

If the item is a layout, the implicit maximum height will be the maximum height the layout can have without any of its items grow beyond their maximum height. The implicit maximum height for any other item is `Number.POSITIVE_INFINITY`.

Setting this value to -1 will reset the height back to its implicit maximum height.

See also minimumHeight and preferredHeight.

.maximumWidth : real

This property holds the maximum width of an item in a layout. The default value is the items implicit maximum width.

If the item is a layout, the implicit maximum width will be the maximum width the layout can have without any of its items grow beyond their maximum width. The implicit maximum width for any other item is `Number.POSITIVE_INFINITY`.

Setting this value to -1 will reset the width back to its implicit maximum width.

See also minimumWidth and preferredWidth.

.minimumHeight : real

The default value is the items implicit minimum height.

If the item is a layout, the implicit minimum height will be the minimum height the layout can have without any of its items shrink beyond their minimum height. The implicit minimum height for any other item is `0`.

Setting this value to -1 will reset the height back to its implicit minimum height.

See also preferredHeight and maximumHeight.

.minimumWidth : real

This property holds the maximum width of an item in a layout. The default value is the items implicit minimum width.

If the item is a layout, the implicit minimum width will be the minimum width the layout can have without any of its items shrink beyond their minimum width. The implicit minimum width for any other item is `0`.

Setting this value to -1 will reset the width back to its implicit minimum width.

See also preferredWidth and maximumWidth.

.preferredHeight : real

This property holds the preferred height of an item in a layout. If the preferred height is -1 it will be ignored, and the layout will use implicitHeight instead. The default is `-1`.

See also minimumHeight and maximumHeight.

.preferredWidth : real

This property holds the preferred width of an item in a layout. If the preferred width is -1 it will be ignored, and the layout will use implicitWidth instead. The default is `-1`.

See also minimumWidth and maximumWidth.

.row : int

This property allows you to specify the row position of an item in a GridLayout.

If both column and this property are not set, it is up to the layout to assign a cell to the item.

The default value is `0`.

See also column and rowSpan.

.rowSpan : int

This property allows you to specify the row span of an item in a GridLayout.

The default value is `1`.

See also columnSpan and row.