Hi @Ahti ,
The reason why you are getting unwanted space is because you have not specified
height and
width to the
Label,for example if you just put a dummy
Rectangle inside the Label and fill it, you will see that it is not covering the complete
Layout.So output will be something like this:-
0_1560747444223_845718c6-64d7-4899-9f67-c3884121a6d3-image.png
If you just specify height and width to the Label,ie.,do the following code change:-
Label {
Layout.fillHeight: true
Layout.fillWidth: true
text: "text_6"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Rectangle {
anchors.fill: parent
color: "transparent"
border.color: "red"
}
}
Note:- Rectangle inside the Label is just for visual purpose.
Sample Output:-
0_1560747547002_1a683aa8-f1cc-4397-b1aa-7ab120f4102c-image.png
Code using Repeater:-
GridLayout {
anchors.fill: parent
anchors.margins: 20
columns: 2
Repeater {
model: 6
Label {
Layout.fillHeight: true
Layout.fillWidth: true
text: "text_1"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Rectangle {
anchors.fill: parent
color: "transparent"
border.color: "red"
}
}
}
}
The sample output of this will be same as shown in point 2.
Note:- You can remove the Rectangle inside the Label, its just for your visual purpose.