I am trying to create a simple layouting example using QtQuick Layouts.
My goal is to display a layout using GridLayout
where I have 3 columns, the first one using 60% of the space, the second and third using 20% each, for a total of 100%.
I would expect the following to give me the expected results, but for some reason it doesn't:
Window
{
width: 1920
height: 1080
visible: true
GridLayout
{
width: parent.width
height: parent.height
columns: 5
Rectangle
{
color: "red"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 3
}
Rectangle
{
color: "green"
Layout.fillHeight: true
Layout.fillWidth: true
}
Rectangle
{
color: "blue"
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
Running the above example gives me the following result, each column using a third of the available space:
What I've tried, without luck:
- Removing the explicit
columns
property for theGridLayout
- Specifying an explicit row count for the
GridLayout
using therows
property - Specifying explicit
column
androw
properties for the rectangles - Specifying explicit
columnSpan
androwSpan
for all rectangles - Fiddling with the number of columns specified for the
GridLayout
- Removing the
Layout.fillWidth
attached properties
What am I doing wrong?