When I first started working with Qt, I would run into the previous problem almost all of the time. When the size of the window changed, everything would break. Things would not be centered or they would go off the screen. Then, I learned about Qt layouts.
In Qt, a layout is flexible way of arranging items onscreen that allows you to specify locations in terms of the size of the containing item. There are several basic types of layouts:
|Vertical||Arranges widgets vertically|
|Horizontal||Arranges widgets horizontally|
|Grid||Arranges widgets in a grid|
|Form||Creates a ...|