Qt Geometry Management

Objectives

  • Learn how to manipulate the geometry of a widget
  • Understand the concepts behind a layout manager in Qt
  • Know and understand the various layout managers
  • Learn how to use widgets with layout a managers
  • Be able to develop own dialog with layouts

Window Geometry

  • QWidget provides several functions that deal with a widget's geometry.

This diagram shows most of the functions in use (from http://doc.trolltech.com/4.1/geometry.html):
geometry.png

Qt Restoring Geometry Example

Layout Managers

  • The Qt layout system provides a simple and way of automatically arranging child widgets within a widget.
  • When a layout is set on a widget it takes care of the following:
    • Positioning the child widgets.
    • Sensible default sizes for windows.
    • Sensible minimum sizes for windows.
    • Resize handling.

Various Layout Managers

  • QBoxLayout: Lays out widgets horizontally.
  • QGridLayout: Lays out widgets in a grid.
  • QVBoxLayout: Layous out widgets vertically.

More information about Qt Layout Managers.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.