Managing the widget layout with layouts

Qt Widgets includes a robust layout system to control the presentation of widgets on the display. In Qt Creator Designer, you can pick from the following layouts:

  • QBoxLayout: This lays out its view children horizontally or vertically
  • QHBoxLayout: This lays out its view children horizontally
  • QVBoxLayout: This lays out its view children vertically
  • QFormLayout: This lays out pairs of widgets (such as labels and textboxes) side by side and then tiles those pairs vertically, giving the appearance of a form
  • QGridLayout: This lays out widgets in a grid
  • QStackedLayout: This shows only a single widget at a time

Using one of these layouts is easy: simply choose the appropriate layout in Qt Creator Designer and drag it to ...

Get Application Development with Qt Creator - Second Edition 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.