Table of Contents
[ fromfile: widgets.xml id: widgets ]
Abstract
This chapter provides an overview of the GUI building blocks in the Qt library, called widgets, and includes some simple examples of how to use them. QtCreator and Designer are used to explore the widgets and their features, and to integrate forms with user code.
A widget is an object of a class derived from QWidget that has a visual representation on the screen.
The structural origins of QWidget are shown in Figure 9.1.
QWidget is a class that uses multiple inheritance (Section 22.3).
A QWidget is a QObject, and thus can have a parent, signals, slots, and managed children.
A QWidget is a QPaintDevice, the base class of all objects that can be "painted" on the screen.
QWidget
s interact with their children in interesting ways.
A widget that has no parent is called a window.
If one widget is a parent of another widget, the boundaries of the child widget lie completely within the boundaries of the parent.[46]
The contained child widget is displayed according to layout rules (Section 9.6 later in this chapter).
A QWidget can handle events by responding to messages from various entities in the window system (e.g., mouse, keyboard, timers, other processes, etc.).
It can paint its own rectangular image on the screen.
It can remove itself from the screen in a way that respects whatever else is on the screen at the moment.
[46] There are some exceptions to this rule. For example, a floating QDockWidget or QDialog can lie outside the boundaries of the parent widget, but is still "in front" of it. Section 10.2 discusses QDocWidget
s.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |