Any class that derives from QMainWindow has four dock window regions, one on each of the four sides of the central widget. These four regions are used for attaching secondary windows to the central widget.
A QDockWidget can be thought of as an envelope for another widget. It has a title bar and a content area to contain the other widget. Depending on how it is set, a QDockWidget can be undocked, resized, dragged to a different location, or docked to the same or to a different dock window region by the end user.
The QMainWindow correctly creates the slidable QSplitters between the central widget and the QDockWidgets. The two principal QMainWindow functions for managing the dock window regions are
DockWindows are very important in integrated development environments, because different tools or views are needed in different situations. Each view is a widget, and they can all be "plugged" into the main window quite easily with the docking mechanism as shown in Figure 11.8.
Figure 11.8. Dragged DockWindows
Like most KDE applications, kdbg, the stand-alone KDE debugger, makes use of DockWindows. kdbg has a source code window (central widget) and dockable views for things such as:
These widgets do not all need to be visible at the same time, so there is a View menu that lets you select or de-select all of the different views. QMainWindow::createPopupMenu() returns this menu, permitting you to add it to toolbars or other pull-down menus.
Views of a QStringList |
Part I: Introduction to C++ and Qt 4
C++ Introduction
Classes
Introduction to Qt
Lists
Functions
Inheritance and Polymorphism
Part II: Higher-Level Programming
Libraries
Introduction to Design Patterns
QObject
Generics and Containers
Qt GUI Widgets
Concurrency
Validation and Regular Expressions
Parsing XML
Meta Objects, Properties, and Reflective Programming
More Design Patterns
Models and Views
Qt SQL Classes
Part III: C++ Language Reference
Types and Expressions
Scope and Storage Class
Statements and Control Structures
Memory Access
Chapter Summary
Inheritance in Detail
Miscellaneous Topics
Part IV: Programming Assignments
MP3 Jukebox Assignments
Part V: Appendices
MP3 Jukebox Assignments
Bibliography
MP3 Jukebox Assignments