QML类型说明-ColumnLayout

ColumnLayout

ImportStatement:   import QtQuick.Layouts 1.1

Inherits:      Item

 

Properties

layoutDirection: enumeration

spacing :real

 

DetailedDescription

这个组件提供干净的API供开发人员进行Column布局。它为Column下的组件提供下面的附加属性:

Layout.minimumWidth

Layout.minimumHeight

Layout.preferredWidth

Layout.preferredHeight

Layout.maximumWidth

Layout.maximumHeight

Layout.fillWidth

Layout.fillHeight

Layout.alignment

 

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

    }

}

代码的效果如下:



关于附加属性更多的信息,可以参阅RowLayout、GridLayout和Column.

 

PropertyDocumentation

layoutDirection: enumeration

组件在Column中的布局方向是从左到右,还是从右到左。如果Qt.RightToLeft被指定,左对齐的组件变成右对齐,右对齐的组件变成左对齐。它可能是下面的值之一:

Qt.LeftToRight(默认) -组件从左到右布局。

Qt.RightToLeft- 组件从右到左布局。

这个QML属性在QtQuick.Layouts 1.1中被介绍。

同时参阅GridLayout::layoutDirection和RowLayout::layoutDirection。

 

spacing :real

这个属性是相邻组件之间的空间,默认值为5。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值