Reputation: 2148
I want to create a 3x2 Grid and put 6 elements inside of it. I want these 6 elements to have automatic size, that is, have the width and height of one square of the grid.
GridLayout {
columns: 3
rows: 2
width: 1280
height: 720
MyCustomCppItem {
someProperty: "hello"
}
}
but if I don't specify a width and height my item isn't even instantiated. How should I do?
Upvotes: 0
Views: 1200
Reputation: 6584
If you don't want to specify a size, you have to set the properties Layout.fillHeight: true
and Layout.fillWidth: true
in each item in your layout.
The layout will arrange the items to occupy all the available space.
Upvotes: 3