ColumnLayout QML Type

Identical to GridLayout, but having only one column. More...

Import Statement: import QtQuick.Layouts



Detailed Description

To be able to use this type more efficiently, it is recommended that you understand the general mechanism of the Qt Quick Layouts module. Refer to Qt Quick Layouts Overview for more information.

It is available as a convenience for developers, as it offers a cleaner API.

Items in a ColumnLayout support these attached properties:

    spacing: 2

    Rectangle {
        Layout.alignment: Qt.AlignCenter
        color: "red"
        Layout.preferredWidth: 40
        Layout.preferredHeight: 40

    Rectangle {
        Layout.alignment: Qt.AlignRight
        color: "green"
        Layout.preferredWidth: 40
        Layout.preferredHeight: 70

    Rectangle {
        Layout.alignment: Qt.AlignBottom
        Layout.fillHeight: true
        color: "blue"
        Layout.preferredWidth: 70
        Layout.preferredHeight: 40

Read more about attached properties here.

See also RowLayout, GridLayout, StackLayout, Column, and Qt Quick Layouts Overview.

Property Documentation

[since QtQuick.Layouts 1.1] layoutDirection : enumeration

This property holds the layout direction of the column layout - it controls whether items are laid out from left to right or right to left. If Qt.RightToLeft is specified, left-aligned items will be right-aligned and right-aligned items will be left-aligned.

Possible values:

Qt.LeftToRight(default) Items are laid out from left to right.
Qt.RightToLeftItems are laid out from right to left

This property was introduced in QtQuick.Layouts 1.1.

See also GridLayout::layoutDirection and RowLayout::layoutDirection.

spacing : real

This property holds the spacing between each cell. The default value is 5.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.