![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QTabBar class provides a tab bar for use in tabbed dialogs, for example. More...
#include <qtabbar.h>
Inherits QWidget.
The QTabBar class provides a tab bar for use in tabbed dialogs, for example.
The class is quite simple: it draws the tabs in one of four shapes and emits a signal when one is selected. It can be subclassed to tailor the look and feel.
QTabBar itself supports four possible shapes, described in the QTabBar::Shape documentation.
The choice of tab shape is still a matter of taste, to a large degree. Tab dialogs (preferences and the like) 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). There is no strong tradition yet, however, so use your taste and create the tradition!
The most important part of QTabBar's API is the signal selected(). It is emitted whenever the selected page changes (even at startup, when the selected page changes from 'none'). There are 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:
Allocates a new id, sets newTab's id, locates it just to the right of the existing tabs, inserts an accelerator if the tab's label contains the string "&p" for some value of p, adds it to the bar and returns the newly allocated id.
Returns the number of tabs in the tab bar. See the "count" property for details.
Returns the id of the currently visible tab in the tab bar. See the "currentTab" property for details.
See also tabAt.
If index is not specified, the tab is simply added. Otherwise it's inserted at the specified position.
Allocates a new id, sets newTab's id, locates it respectively, inserts an accelerator if the tab's label contains the string "&p" for some value of p, adds it to the bar and returns the newly allocated id.
See also setTabEnabled().
Returns the id of the tab that currently has the keyboard focus. See the "keyboardFocusTab" property for details.
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 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 currently visible tab in the tab bar. 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 this 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 this tab bar. See the "shape" property for details.
See also count.
See also indexOf.
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 currently visible tab in the tab bar.
If no tab page is currently visible, -1 will be the current value for this property. Even if the property value is not -1, you cannot assume either 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 currently has the keyboard focus.
This property contains the id of the tab that currently has the keyboard focus. If this tab bar does not have keyboard focus, the value of this property will be -1.
Get this property's value with keyboardFocusTab().
This property holds the shape of this tab bar.
The value of this property can be one of the following: RoundedAbove (default), RoundedBelow, TriangularAbove or TriangularBelow.
Set this property's value with setShape() and get this property's value with shape().
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-beta2
|