Search code examples
c++qtautoresize

Autoresizing widgets in Qt


How to make widget change size after it's parent window changed size? I have a widget which should match 30% of parent width and 100% of height.

There is no tutorial information in google. I've just found that it can be done via layouts.


Solution

  • Height should happen automatically if the widget is expanding. For the 30% width you need to set the stretch factors in the widgets to have a 3:7 ratio where 7 is the sum of all the other widgets next to this one.

    For anything more you have to show some code of what you have tried.