.BI "QString \fBtabToolTip\fR ( QWidget * w ) const"
.br
.ti -1c
.BI "QWidget * \fBcurrentPage\fR () const"
.br
.ti -1c
.BI "QWidget * \fBpage\fR ( int index ) const"
.br
.ti -1c
.BI "QString \fBlabel\fR ( int index ) const"
.br
.ti -1c
.BI "int \fBcurrentPageIndex\fR () const"
.br
.ti -1c
.BI "int \fBindexOf\fR ( QWidget * w ) const"
.br
.ti -1c
.BI "enum \fBTabPosition\fR { Top, Bottom }"
.br
.ti -1c
.BI "TabPosition \fBtabPosition\fR () const"
.br
.ti -1c
.BI "void \fBsetTabPosition\fR ( TabPosition )"
.br
.ti -1c
.BI "enum \fBTabShape\fR { Rounded, Triangular }"
.br
.ti -1c
.BI "TabShape \fBtabShape\fR () const"
.br
.ti -1c
.BI "void \fBsetTabShape\fR ( TabShape s )"
.br
.ti -1c
.BI "int \fBmargin\fR () const"
.br
.ti -1c
.BI "void \fBsetMargin\fR ( int )"
.br
.ti -1c
.BI "int \fBcount\fR () const"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "void \fBsetCurrentPage\fR ( int )"
.br
.ti -1c
.BI "virtual void \fBshowPage\fR ( QWidget * w )"
.br
.ti -1c
.BI "virtual void \fBremovePage\fR ( QWidget * w )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBcurrentChanged\fR ( QWidget * )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBautoMask\fR - whether the tab widget is automatically masked \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBcount\fR - the number of tabs in the tab bar \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBcurrentPage\fR - the index position of the current tab page"
.br
.ti -1c
.BI "int \fBmargin\fR - the margin in this tab widget"
.br
.ti -1c
.BI "TabPosition \fBtabPosition\fR - the position of the tabs in this tab widget"
.br
.ti -1c
.BI "TabShape \fBtabShape\fR - the shape of the tabs in this tab widget"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "void \fBsetTabBar\fR ( QTabBar * tb )"
.br
.ti -1c
.BI "QTabBar * \fBtabBar\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QTabWidget class provides a stack of tabbed widgets.
.PP
A tab widget provides a tab bar of tabs and a `page area' below (or above, see TabPosition) the tabs. Each tab is associated with a different widget (called a `page'). Only the current tab's page is shown in the page area; all the other tabs' pages are hidden. The user can show a different page by clicking on its tab or by pressing its Alt+\fIletter\fR accelerator if it has one.
.PP
The normal way to use QTabWidget is to do the following in the constructor: <ol type=1>
.IP 1
Create a QTabWidget.
.IP 2
Create a QWidget for each of the pages in the tab dialog, insert children into it, set up geometry management for it and use addTab() (or insertTab()) to set up a tab and keyboard accelerator for it.
.IP 3
Connect to the signals and slots.
.PP
The position of the tabs is set with setTabPosition(), their shape with setTabShape(), and their margin with setMargin().
.PP
If you don't call addTab() and the QTabWidget is already visible, then the page you have created will not be visible. 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.
.PP
The signal currentChanged() is emitted when the user selects a page.
.PP
The current page is available as an index position with currentPageIndex() or as a wiget pointer with currentPage(). You can retrieve a pointer to a page with a given index using page(), and can find the index position of a page with indexOf(). Use setCurrentPage() to show a particular page by index, or showPage() to show a page by widget pointer.
.PP
You can change a tab's label and iconset using changeTab() or setTabLabel() and setTabIconSet(). A tab page can be removed with removePage().
.PP
Each tab is either enabled or disabled at any given time (see setTabEnabled()). If a tab is enabled, the tab text is drawn normally 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.
.PP
Although tab widgets can be a very good way to split up a complex dialog, it's also very easy to get into a mess. See QTabDialog for some design hints. An alternative is to use a QWidgetStack for which you provide some means of navigating between pages, for example, a QToolBar or a QListBox.
.PP
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).
.PP
.ce 1
.B "[Image Omitted]"
.PP
.ce 1
.B "[Image Omitted]"
.PP
See also QTabDialog, QToolBox, Advanced Widgets, and Organizers.
.SS "Member Type Documentation"
.SH "QTabWidget::TabPosition"
This enum type defines where QTabWidget draws the tab row:
.TP
\fCQTabWidget::Top\fR - above the pages
.TP
\fCQTabWidget::Bottom\fR - below the pages
.SH "QTabWidget::TabShape"
This enum type defines the shape of the tabs:
.TP
\fCQTabWidget::Rounded\fR - rounded look (normal)
.TP
\fCQTabWidget::Triangular\fR - triangular look (very unusual, included for completeness)
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QTabWidget::QTabWidget ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
Constructs a tabbed widget called \fIname\fR with parent \fIparent\fR, and widget flags \fIf\fR.
The new page is \fIchild\fR; the tab's label is \fIlabel\fR. 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 and other factors.
.PP
If the tab's \fIlabel\fR contains an ampersand, the letter following the ampersand is used as an accelerator for the tab, e.g. if the label is "Bro&wse" then Alt+W becomes an accelerator which will move the focus to this tab.
.PP
If you call addTab() after show() the screen will flicker and the user may be confused.
.PP
Adding the same child twice will have undefined behavior.
.PP
See also insertTab().
.PP
Examples:
.)l addressbook/centralwidget.cpp and themes/themes.cpp.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
This is a low-level function for adding tabs. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() function for a subclass of QTab. The \fIchild\fR is the new page and \fItab\fR is the tab to put the \fIchild\fR on.
This signal is emitted whenever the current page changes. The parameter is the new current page.
.PP
See also currentPage(), showPage(), and tabLabel().
.SH "QWidget * QTabWidget::currentPage () const"
Returns a pointer to the page currently being displayed by the tab dialog. The tab dialog does its best to make sure that this value is never 0 (but if you try hard enough, it can be).
.SH "int QTabWidget::currentPageIndex () const"
Returns the index position of the current tab page. See the "currentPage" property for details.
.SH "int QTabWidget::indexOf ( QWidget * w ) const"
Returns the index position of page \fIw\fR, or -1 if the widget cannot be found.
.SH "void QTabWidget::insertTab ( QWidget * child, const QString & label, int index = -1 )\fC [virtual]\fR"
Inserts another tab and page to the tab view.
.PP
The new page is \fIchild\fR; the tab's label is \fIlabel\fR. 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 and other factors.
.PP
If the tab's \fIlabel\fR contains an ampersand, the letter following the ampersand is used as an accelerator for the tab, e.g. if the label is "Bro&wse" then Alt+W becomes an accelerator which will move the focus to this tab.
.PP
If \fIindex\fR is not specified, the tab is simply appended. Otherwise it is inserted at the specified position.
.PP
If you call insertTab() after show(), the screen will flicker and the user may be confused.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts another tab and page to the tab view.
.PP
This function is the same as insertTab(), but with an additional \fIiconset\fR.
.SH "void QTabWidget::insertTab ( QWidget * child, QTab * tab, int index = -1 )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
This is a lower-level method for inserting tabs, similar to the other insertTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() function for a subclass of QTab. The \fIchild\fR is the new page, \fItab\fR is the tab to put the \fIchild\fR on and \fIindex\fR is the position in the tab bar that this page should occupy.
.SH "bool QTabWidget::isTabEnabled ( QWidget * w ) const"
Returns TRUE if the page \fIw\fR is enabled; otherwise returns FALSE.
.PP
See also setTabEnabled() and QWidget::enabled.
.SH "QString QTabWidget::label ( int index ) const"
Returns the label of the tab at index position \fIindex\fR or QString::null if the \fIindex\fR is out of range.
.SH "int QTabWidget::margin () const"
Returns the margin in this tab widget. See the "margin" property for details.
.SH "QWidget * QTabWidget::page ( int index ) const"
Returns the tab page at index position \fIindex\fR or 0 if the \fIindex\fR is out of range.
.SH "void QTabWidget::removePage ( QWidget * w )\fC [virtual slot]\fR"
Removes page \fIw\fR from this stack of widgets. Does not delete \fIw\fR.
.PP
See also addTab(), showPage(), and QWidgetStack::removeWidget().
.SH "void QTabWidget::removeTabToolTip ( QWidget * w )"
Removes the tab tool tip for page \fIw\fR. If the page does not have a tip, nothing happens.
Replaces the dialog's QTabBar heading with the tab bar \fItb\fR. Note that this must be called \fIbefore\fR any tabs have been added, or the behavior is undefined.
If \fIenable\fR is TRUE, page \fIw\fR is enabled; otherwise page \fIw\fR is disabled. The page's tab is redrawn appropriately.
.PP
QTabWidget uses QWidget::setEnabled() internally, rather than keeping a separate flag.
.PP
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.