ColumnLayout QML Type

Identical to GridLayout , but having only one column. 更多...

import 语句: import QtQuick.Layouts
继承:

Item

特性

详细描述

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 概述 了解更多信息。

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

Items in a ColumnLayout support these attached properties:

ColumnLayout{
    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 .

另请参阅 RowLayout , GridLayout , StackLayout , Column ,和 Qt Quick Layouts 概述 .

特性文档编制

layoutDirection : enumeration [since QtQuick.Layouts 1.1]

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.

可能的值:

常量 描述
Qt.LeftToRight (default) Items are laid out from left to right.
Qt.RightToLeft Items are laid out from right to left

This property was introduced in QtQuick.Layouts 1.1.

另请参阅 GridLayout::layoutDirection and RowLayout::layoutDirection .

spacing : real

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

uniformCellSizes : bool [since QtQuick.Layouts 6.6]

If this property is set to true , the layout will force all cells to have a uniform size.

注意: This API is considered tech preview and may change or be removed in future versions of Qt.

This property was introduced in QtQuick.Layouts 6.6.

另请参阅 GridLayout::uniformCellWidths , GridLayout::uniformCellHeights ,和 RowLayout::uniformCellSizes .