![]() |
Home · Examples |
[Previous: Qt Designer's Widget Editing Mode][Qt Designer Manual][Next: Creating Main Windows in Qt Designer]
Container widgets provide high level control over groups of objects on a form. They can be used to perform a variety of functions, such as managing input widgets, providing paged and tabbed layouts, or just acting as decorative containers for other objects.
Since many containers offer specialized functionality, they require a little more explanation than ordinary widgets in order to make the most of them.
Stacked widgets, tab widgets, and toolboxes are handled specially in Qt Designer. Normally, when adding pages (tabs, pages, compartments) to these containers in your own code, you need to supply existing widgets, either as placeholders or containing child widgets. In Qt Designer, these are automatically created for you, so you can add child objects to each page straight away. New pages are added to each of these containers in the same way: Select the container on the form, open the context menu, and select Insert Page. Then you are given the option of inserting the page before or after the current page. To delete the current page, select the container widget then select the Delete Page from the context menu.
Each container typically allows its child objects to be arranged in one or more layouts. The type of layout management provided depends on each container, although setting the layout is usually just a matter of selecting the container by clicking it, and applying a layout.Frames
![]() | Frames Frames are used to enclose and group widgets, and to provide decoration. They are used as the foundation for more complex containers, but they can also be used as placeholders in forms. |
Each frame can contain its own layout. Select the frame and apply the layout as usual.Group Boxes
![]() | Group Boxes Group boxes are usually used to group together collections of checkboxes and radio buttons with similar purposes. |
Each group box can contain its own layout, and this is necessary if it contains other widgets. To add a layout to the group box, click inside it and apply the layout as usual.Stacked Widgets
![]() | Stacked Widgets Stacked widgets are collections of widgets in which only the topmost layer is visible. Control over the visible layer is usually managed by another widget, such as a combobox, using signals and slots. |
Each page in the stack can be given its own layout, and this is necessary if the page contains other objects. To add a layout to a page, click inside the widget and apply the layout as usual.Tab Widgets
![]() | Tab Widgets Tab widgets allow the developer to split up the contents of a widget into different labelled sections, only one of which is displayed at any given time. By default, the tab widget contains two tabs, and these can be deleted or renamed as required. You can also add additional tabs. |
Each tab can be given its own layout, and one must be defined for each tab that contains other objects. To add a layout to a tab, click inside it and apply the layout as usual.Toolbox Widgets
![]() | ToolBox Widgets Toolbox widgets provide a series of pages or compartments in a toolbox, much like the toolbox used in Qt 3's Qt Designer. Toolboxes are handled in much the same way as stacked widgets. To rename a page in a toolbox, make it the current page, open the Property Editor, and change the currentItemText property. To add a new page, select the toolbox widget, open the context menu, and select Insert Page. Then you are given the option of adding the page either before or after the current page. To delete the current page, select the toolbox widget, open the context menu, and select Delete Page. |
![]() | Dock Widgets Dock widgets are floating panels, often containing input widgets and more complex controls, that are either attached to the edges of the main window in "dock areas" or floated as independent tool windows. Although dock widgets can be added to any type of form, they are typically used with forms created from the main window template. |
Copyright © 2008 Nokia | Trademarks | Qt Jambi 4.4.3_01 |