3

is there a way to configure QHBoxLayout, so when the added widgets(different in width) reach the end of the line, they would be added to a new line? How would you even detect if the last added widget crosses the end of the line?

ulak blade
  • 2,515
  • 5
  • 37
  • 81

1 Answers1

2

You can't do that with a QHBoxLayout, since there isn't the concept of "new line".

You can manually adjust a QGridLayout. You can see this related question on SO.

Or you can use the Qt FlowLayout. It's not a built-in layout, but in Qt FlowLayout Example you can find an example with the implementation.

Community
  • 1
  • 1
Miki
  • 40,887
  • 13
  • 123
  • 202