xxxxxxxxxx
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
ApplicationWindow {
visible: true
width: 480
height: 480
title: qsTr("Hello World")
GridLayout {
id: grid
anchors.fill: parent
rows: 3
columns: 3
Rectangle {
color: "red"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 2
Layout.rowSpan: 1
Layout.row: 1
Layout.column: 2
}
Rectangle {
color: "blue"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 1
Layout.rowSpan: 2
Layout.row: 1
Layout.column: 1
}
Rectangle {
color: "green"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 1
Layout.rowSpan: 2
Layout.row: 2
Layout.column: 3
}
Rectangle {
color: "white"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 1
Layout.rowSpan: 1
Layout.row: 2
Layout.column: 2
}
Rectangle {
color: "yellow"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 2
Layout.rowSpan: 1
Layout.row: 3
Layout.column: 1
}
}
}
xxxxxxxxxx
import QtQuick 2.5
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
GridLayout {
anchors.fill: parent
columns: 5
rows: 2
Rectangle {
Layout.column: 0
Layout.columnSpan: 4
Layout.row: 0
Layout.rowSpan: 2
Layout.fillHeight: true
Layout.fillWidth: true
color: "red"
}
Rectangle {
Layout.column: 4
Layout.columnSpan: 1
Layout.row: 0
Layout.rowSpan: 2
Layout.fillHeight: true
Layout.fillWidth: true
color: "green"
}
Rectangle {
Layout.column: 0
Layout.columnSpan: 5
Layout.row: 2
Layout.rowSpan: 3
Layout.fillHeight: true
Layout.fillWidth: true
color: "blue"
}
}
}