import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Item {
id: rootItem
anchors.fill: parent
// 流式布局
Flow {
anchors.left: parent.left
anchors.right: parent.right
flow: Flow.LeftToRight
//flow: Flow.TopToBottom // 从上往下
Rectangle {
height: 100
width: rootItem.width/2
color: "red"
}
Rectangle {
height: 100
width: rootItem.width/2
color: "yellow"
}
Rectangle {
height: 100
width: rootItem.width/2
color: "blue"
}
}
}
}
原文:https://www.cnblogs.com/lodger47/p/14774300.html