Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs. More...
#include <qtabbar.h>
Inherits QWidget.
QTabBar is straightforward to use; it draws the tabs using one of the predefined shapes, and emits a signal when a tab is selected. It can be subclassed to tailor the look and feel. Qt also provides a ready-made QTabWidget and a QTabDialog.
The choice of tab shape is a matter of taste, although tab dialogs (for preferences and similar) invariably use RoundedAbove; nobody uses TriangularAbove. Tab controls in windows other than dialogs almost always use either RoundedBelow or TriangularBelow. Many spreadsheets and other tab controls in which all the pages are essentially similar use TriangularBelow, whereas RoundedBelow is used mostly when the pages are different (e.g. a multi-page tool palette).
The most important part of QTabBar's API is the selected() signal. This is emitted whenever the selected page changes (even at startup, when the selected page changes from 'none'). There is also a slot, setCurrentTab(), which can be used to select a page programmatically.
QTabBar creates automatic accelerator keys in the manner of QButton; e.g. if a tab's label is "&Graphics", Alt+G becomes an accelerator key for switching to that tab.
The following virtual functions may need to be reimplemented:
The index of the current tab is returned by currentTab(). The tab with a particular index is returned by tabAt(), the tab with a particular id is returned by tab(). The index of a tab is returned by indexOf(). The current tab can be set by index or tab pointer using one of the setCurrentTab() functions.
See also Advanced Widgets.
This enum type lists the built-in shapes supported by QTabBar:
Sets newTab's id to a new id and places the tab just to the right of the existing tabs. If the tab's label 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. Returns the id.
See also insertTab().
Returns the number of tabs in the tab bar. See the "count" property for details.
Returns the id of the tab bar's visible tab. See the "currentTab" property for details.
See also tabAt().
If index is not specified, the tab is simply appended. Otherwise it's inserted at the specified position.
Sets newTab's id to a new id. If the tab's label 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. Returns the id.
See also addTab().
See also setTabEnabled().
Returns the id of the tab that has the keyboard focus. See the "keyboardFocusTab" property for details.
QTabBar emits the signal whenever the layout of the tab bar has been recalculated, for example when the contents of a tab change.
This virtual function may be reimplemented to change the look of QTabBar. If you decide to reimplement it, you may also need to reimplement sizeHint().
See also paint().
Reimplemented from QWidget.
See also mousePressEvent() and mouseReleaseEvent().
QTabBar emits this signal whenever any tab is selected, whether by the program or by the user. The argument id is the id of the tab as returned by addTab().
show() is guaranteed to emit this signal; you can display your page in a slot connected to this signal.
Sets the id of the tab bar's visible tab. See the "currentTab" property for details.
Raises tab and emits the selected() signal unless the tab was already current.
See also currentTab and selected().
Sets the shape of the tabs in the tab bar. See the "shape" property for details.
setTabEnabled() updates the display if this causes a change in id's status.
See also update() and isTabEnabled().
Returns the shape of the tabs in the tab bar. See the "shape" property for details.
See also count.
See also indexOf().
This list is unlikely to be in the order that the QTab elements appear visually. One way of iterating over the tabs is like this:
for ( uint i = 0; i < myTabBar->count(); ++i ) { nextTab = myTabBar->tabAt( i ); // do something with nextTab }
This property holds the number of tabs in the tab bar.
Get this property's value with count().
See also tab().
This property holds the id of the tab bar's visible tab.
If no tab page is currently visible, the property's value is -1. Even if the property's value is not -1, you cannot assume that the user can see the relevant page, or that the tab is enabled. When you need to display something the value of this property represents the best page to display.
When this property is set to id, it will raise the tab with the id id and emit the selected() signal.
See also selected() and isTabEnabled().
Set this property's value with setCurrentTab() and get this property's value with currentTab().
This property holds the id of the tab that has the keyboard focus.
This property contains the id of the tab that has the keyboard focus or -1 if the tab bar does not have the keyboard focus.
Get this property's value with keyboardFocusTab().
This property holds the shape of the tabs in the tab bar.
The value of this property is one of the following: RoundedAbove (default), RoundedBelow, TriangularAbove or TriangularBelow.
See also Shape.
Set this property's value with setShape() and get this property's value with shape().
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Copyright © 2003 Trolltech | Trademarks | Qt version 3.2.0b2
|