![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QTabWidget class provides a stack of tabbed widgets. More...
#include <qtabwidget.h>
Inherits QWidget.
The QTabWidget class provides a stack of tabbed widgets.
A tabbed widget is one in which several "pages" are available and the user selects which page to see and use by clicking on its tab or by pressing the indicated Alt-letter key combination.
QTabWidget does not provide more than one row of tabs and does not provide tabs along the sides or bottom of the pages.
The normal way to use QTabWidget is to do the following in the constructor:
If you don't call addTab() the page you have created will not be visible. Please don't confuse the object name you supply to the QWidget constructor and the tab label you supply to addTab(). addTab() takes a name which indicates an accelerator and is meaningful and descriptive to the user, whereas the widget name is used primarily for debugging.
The signal currentChanged() is emitted when the user selects a page.
Each tab is either enabled or disabled at any given time. If a tab is enabled, the tab text is drawn in black and the user can select that tab. If it is disabled, the tab is drawn in a different way and the user cannot select that tab. Note that even if a tab is disabled, the page can still be visible, for example if all of the tabs happen to be disabled.
Although tab widgets can be a very good way to split up a complex dialog, it's also very easy to make a royal mess out of it. See QTabDialog for some design hints.
Most of the functionality in QTabWidget is provided by a QTabBar (at the top, providing the tabs) and a QWidgetStack (most of the area, organizing the individual pages).
See also QTabDialog.
This enum type defines where QTabWidget can draw the tab row:
This enum type defines the shape of the tabs:
The tab will be labeled label; child constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to setTabEnabled(), for example) and the tab label. The name is internal to the program and invariant, whereas the label is shown on-screen and may vary according to language, for example.
label is written in the QButton style, in which &P makes Qt create an accelerator key on Alt-P for this page. For example:
td->addTab( graphicsPane, "&Graphics" ); td->addTab( soundPane, "&Sound" );
If the user presses Alt-S the sound page of the tab dialog is shown; if the user presses Alt-P the graphics page is shown.
If you call addTab() after show(), the screen will flicker and the user will be confused.
Examples: addressbook/centralwidget.cpp and themes/themes.cpp.
This function is the same as addTab(), but with an additional iconset.
This signal is emitted whenever the current page changes.
See also currentPage(), showPage() and tabLabel().
Returns the id of the current tab page. See the "currentPage" property for details.
The tab will be labeled label; child constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to setTabEnabled(), for example) and the tab label. The name is internal to the program and invariant, whereas the label is shown on-screen and may vary according to language, for example.
label is written in the QButton style, in which &P makes Qt create an accelerator key on Alt-P for this page. For example:
td->insertTab( graphicsPane, "&Graphics" ); td->insertTab( soundPane, "&Sound" );
If index is not specified, the tab is simply added. Otherwise it is inserted at the specified position.
If the user presses Alt-S the sound page of the tab dialog is shown; if the user presses Alt-P the graphics page is shown.
If you call insertTab() after show(), the screen will flicker and the user will be confused.
This function is the same as insertTab(), but with an additional iconset.
See also setTabEnabled() and QWidget::enabled.
Returns the margin in this tab widget. See the "margin" property for details.
Reimplemented from QWidget.
See also showPage() and QWidgetStack::removeWidget().
Sets the id of the current tab page. See the "currentPage" property for details.
Sets the margin in this tab widget. See the "margin" property for details.
See also tabBar().
QTabWidget uses QWidget::setEnabled() internally, rather than keeping a separate flag.
Note that even a disabled tab/page may be visible. If the page is visible already, QTabWidget will not hide it; if all the pages are disabled, QTabWidget will show one of them.
See also isTabEnabled() and QWidget::enabled.
Sets the position of the tabs in this tab widget. See the "tabPosition" property for details.
Sets the shape of the tabs in this tab widget to s. See the "tabShape" property for details.
Warning: Used carelessly, this function can easily surprise or confuse the user.
See also QTabBar::currentTab.
See also setTabBar().
Returns the position of the tabs in this tab widget. See the "tabPosition" property for details.
Returns the shape of the tabs in this tab widget. See the "tabShape" property for details.
This property holds the id of the current tab page.
Set this property's value with setCurrentPage() and get this property's value with currentPageIndex().
See also QTabBar::currentPage().
This property holds the margin in this tab widget.
The margin is the distance between the innermost pixel of the frame and the outermost pixel of the pages.
Set this property's value with setMargin() and get this property's value with margin().
This property holds the position of the tabs in this tab widget.
Possible values for this property are QTabWidget::Top and QTabWidget::Bottom.
Set this property's value with setTabPosition() and get this property's value with tabPosition().
This property holds the shape of the tabs in this tab widget.
Possible values for this property are QTabWidget::Rounded (default) or QTabWidget::Triangular.
Set this property's value with setTabShape() and get this property's value with tabShape().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|