Making a more flexible display using layouts

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:

Layout Description
Vertical Arranges widgets vertically
Horizontal Arranges widgets horizontally
Grid Arranges widgets in a grid
Form Creates a ...

Get Hands-On Embedded Programming with Qt now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.