The QTabWidget class provides a stack of tabbed widgets. More...
#include <qtabwidget.h>
Inherits QWidget.
Type | Name | READ | WRITE | Options |
---|---|---|---|---|
TabPosition | tabPosition | tabPosition | setTabPosition | |
TabShape | tabShape | tabShape | setTabShape | |
int | margin | margin | setMargin | |
int | currentPage | currentPageIndex | setCurrentPage |
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, while the widget name is used primarily for debugging.
A signal currentChanged() is emitted when the user selects some 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 can not select that tab. Note that even though a tab is disabled, the page can still be visible, for example if all of the tabs happen to be disabled.
While 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.
Top
- above the pages
Bottom
- below the pages
Rounded
- rounded look (normal)
Triangular
- triangular look (very unusual, included for completeness)
Constructs a tabbed widget with parent parent, name name and widget flags f.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Destructs the tab widget.
This is a lower-level method for adding tabs, similar to the other addTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() routine for a subclass of QTab.
Adds another tab and page to the tab view.
This function is the same as addTab() but with an additional iconset.
Adds another tab and page to the tab view.
The tab will be labelled label and child constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to e.g. setTabEnabled()) and the tab label: The name is internal to the program and invariant, while the label is shown on screen and may vary according to e.g. language.
label is written in the QButton style, where &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.
Defines a new iconset and a new label for the tab of page w
Defines a new label for the tab of page w
[signal]
This signal is emitted whenever the current page changes.
See also currentPage(), showPage() and tabLabel().
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.
Returns the ID of the current page.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QObject.
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() routine for a subclass of QTab.
Inserts another tab and page to the tab view.
This function is the same as insertTab() but with an additional iconset.
Inserts another tab and page to the tab view.
The tab will be labelled label and child constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to e.g. setTabEnabled()) and the tab label: The name is internal to the program and invariant, while the label is shown on screen and may vary according to e.g. language.
label is written in the QButton style, where &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's 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.
Returns TRUE if the page w is enabled, and false if it is disabled.
See also setTabEnabled() and QWidget::isEnabled().
Returns the width of the margin. The margin is the distance between the innermost pixel of the frame and the outermost pixel of the pages.
See also setMargin().
[virtual]
Returns a suitable minimum size for the tab widget.
Reimplemented from QWidget.
Removes page w from this stack of widgets. Does not delete w.
See also showPage() and QWidgetStack::removeWidget().
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Sets the page with index id as current page.
Sets the width of the margin to w.
See also margin().
[protected]
Replaces the QTabBar heading the dialog by the given tab bar. Note that this must be called before any tabs have been added, or the behavior is undefined.
See also tabBar().
Enables/disables page w according to the value of enable, and redraws the page's tab appropriately.
QTabWidget uses QWidget::setEnabled() internally, rather than keep a separate flag.
Note that even a disabled tab/page may be visible. If the page is visible already, QTabWidget will not hide it, and if all the pages are disabled, QTabWidget will show one of them.
See also isTabEnabled() and QWidget::setEnabled().
Sets the position of the tabs to pos
Possible values are QTabWidget::Top and QTabWidget::Bottom.
See also tabPosition().
Sets the shape of the tabs to s.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Ensures that w is shown. This is useful mainly for accelerators.
Warning: Used carelessly, this function can easily surprise or confuse the user.
See also QTabBar::setCurrentTab().
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[protected]
Returns the currently set QTabBar.
See also setTabBar().
Returns the text in the tab for page w.
Returns the position of the tabs.
Possible values are QTabWidget::Top and QTabWidget::Bottom.
See also setTabPosition().
Returns the shape of the tabs.
See also setTabShape().
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright İ 2000 Trolltech | Trademarks | Qt version 2.2.1
|