Skip to Content
Programming with Qt, 2nd Edition
book

Programming with Qt, 2nd Edition

by Matthias Kalle Dalheimer
January 2002
Beginner to intermediate
522 pages
14h 36m
English
O'Reilly Media, Inc.
Content preview from Programming with Qt, 2nd Edition

Chapter 6. Using Layout Managers

So far, we have laid out our widgets in a very basic manner. We have set absolute positions and sizes with QWidget::resize and QWidget::move() or QWidget::setGeometry(), and we have specified the position within the parent and the size at which a widget should be shown. This process is generally not desirable. It makes the window that contains the widgets (often a dialog box) look bad when it is resized. If the size of this window is increased, an empty space will appear at the right and lower borders of the window because the widgets stay at their fixed positions and do not fill the newly available space. If, on the other hand, the size of the window is decreased, some widgets will not be visible any longer, or the window might appear incomplete. Again, this occurs because the widgets do not occupy less space and use less intrawidget space to accommodate the smaller parent window.

Another disadvantage comes from internationalization. When you prepare your program to display text in different languages, on-screen text in different languages are rarely the same size. If you design your dialog boxes with English labels and then have your application translated into a language such as Finnish, in which the average word length is long, the text will probably not fit into the allocated space.

Layout Manager Basics

The solution to these two problems is geometry management, also called layout management. When using geometry management, sizes and positions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield
C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield

Publisher Resources

ISBN: 0596000642Supplemental ContentErrata Page