I have a ColumnLayout
, which has its anchor set to anchor.fill: parent
, therefore it has already a set dimension, which depends on its parent dimension.
How can I add Rectangles
into this ColumnLayout
, with a specific spacing from top to bottom?
Right now I have this:
ColumnLayout {
anchors.fill: parent
spacing: 2
Rectangle {
height: 50
width: 50
color: "red"
}
Rectangle {
height: 50
width: 50
color: "green"
}
Rectangle {
height: 50
width: 50
color: "blue"
}
}
But instead of having the rectangles from top to bottom with a spacing 2
it layouts the Rectangle
s evenly in the ColumnLayout
.
One solution would be to anchor the first rectangle to the parent's top and the anchor the rest of the rectangles one after the other, but I would like to avoid this if possible.