Another useful widget for managing layouts is QWidgetStack. This widget contains a set of child widgets, or "pages", and shows only one at a time, hiding the others from the user. The pages are numbered from 0. If we want to make a specific child widget visible, we can call raiseWidget() with either a page number or a pointer to the child widget.
The QWidgetStack itself is invisible and provides no intrinsic means for the user to change page. The small arrows and the dark gray frame in Figure 6.7 are provided by Qt Designer to make the QWidgetStack easier to design with.
Figure 6.7. QWidgetStack
The Configure dialog shown in Figure 6.8 is an example that uses QWidgetStack. The dialog consists of a QListBox on the left and a QWidgetStack on the right. Each item in the QListBox corresponds to a different page in the QWidgetStack. Forms like this are very easy to create using Qt Designer:
Figure 6.8. The Configure dialog
Since we have implemented page-switching using predefined signals and slots, the dialog will exhibit the correct page-switching behavior when previewed in Qt Designer.
Part I: Basic Qt
Creating Main Windows
Implementing Application Functionality
Creating Custom Widgets
Part II: Intermediate Qt
2D and 3D Graphics
Drag and Drop
Providing Online Help