13

What is the point of having a GridLayout component, when there is a Grid component? From what I can tell, they seem to be doing the same thing.

Dada
  • 6,313
  • 7
  • 24
  • 43
bobbaluba
  • 3,584
  • 2
  • 31
  • 45

1 Answers1

11

The components from the Layout module added in Qt 5.1 allow you for example to automatically resize your layout dynamically so if the user is able to resize the Window containing the given Layout it will grow/shrink properly. It also allows you to have certain elements fill the rest of the space in your Layout while others have fixed size.

You can read a bit more about Layout in the documentation and also see there is also RowLayout and ColumnLayout

koopajah
  • 23,792
  • 9
  • 78
  • 104
  • 2
    Could you explain this in more detail? If I add a GridLayout, it will absolutely not resize at all. I can use `anchor.fill: parent` but this does also work on a Grid – IceFire May 03 '17 at 19:08
  • Try ``Layout.fillWidth: true`` + ``Layout.preferedWidth: [...]``on childrens – DevMultiTech Apr 16 '20 at 15:37