1QTabBar(3qt)                                                      QTabBar(3qt)
2
3
4

NAME

6       QTabBar - Tab bar, e.g. for use in tabbed dialogs
7

SYNOPSIS

9       #include <qtabbar.h>
10
11       Inherits QWidget.
12
13   Public Members
14       QTabBar ( QWidget * parent = 0, const char * name = 0 )
15       ~QTabBar ()
16       enum Shape { RoundedAbove, RoundedBelow, TriangularAbove,
17           TriangularBelow }
18       Shape shape () const
19       virtual void setShape ( Shape )
20       virtual int addTab ( QTab * newTab )
21       virtual int insertTab ( QTab * newTab, int index = -1 )
22       virtual void removeTab ( QTab * t )
23       virtual void setTabEnabled ( int id, bool enabled )
24       bool isTabEnabled ( int id ) const
25       int currentTab () const
26       int keyboardFocusTab () const
27       QTab * tab ( int id ) const
28       QTab * tabAt ( int index ) const
29       int indexOf ( int id ) const
30       int count () const
31       virtual void layoutTabs ()
32       virtual QTab * selectTab ( const QPoint & p ) const
33       void removeToolTip ( int index )
34       void setToolTip ( int index, const QString & tip )
35       QString toolTip ( int index ) const
36
37   Public Slots
38       virtual void setCurrentTab ( int )
39       virtual void setCurrentTab ( QTab * tab )
40
41   Signals
42       void selected ( int id )
43       void layoutChanged ()
44
45   Properties
46       int count - the number of tabs in the tab bar  (read only)
47       int currentTab - the id of the tab bar's visible tab
48       int keyboardFocusTab - the id of the tab that has the keyboard focus
49           (read only)
50       Shape shape - the shape of the tabs in the tab bar
51
52   Protected Members
53       virtual void paint ( QPainter * p, QTab * t, bool selected ) const
54       virtual void paintLabel ( QPainter * p, const QRect & br, QTab * t,
55           bool has_focus ) const
56       virtual void paintEvent ( QPaintEvent * e )
57       QPtrList<QTab> * tabList ()
58

DESCRIPTION

60       The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs.
61
62       QTabBar is straightforward to use; it draws the tabs using one of the
63       predefined shapes, and emits a signal when a tab is selected. It can be
64       subclassed to tailor the look and feel. Qt also provides a ready-made
65       QTabWidget and a QTabDialog.
66
67       The choice of tab shape is a matter of taste, although tab dialogs (for
68       preferences and similar) invariably use RoundedAbove; nobody uses
69       TriangularAbove. Tab controls in windows other than dialogs almost
70       always use either RoundedBelow or TriangularBelow. Many spreadsheets
71       and other tab controls in which all the pages are essentially similar
72       use TriangularBelow, whereas RoundedBelow is used mostly when the pages
73       are different (e.g. a multi-page tool palette).
74
75       The most important part of QTabBar's API is the selected() signal. This
76       is emitted whenever the selected page changes (even at startup, when
77       the selected page changes from 'none'). There is also a slot,
78       setCurrentTab(), which can be used to select a page programmatically.
79
80       QTabBar creates automatic accelerator keys in the manner of QButton;
81       e.g. if a tab's label is "&Graphics", Alt+G becomes an accelerator key
82       for switching to that tab.
83
84       The following virtual functions may need to be reimplemented:
85
86       paint() paints a single tab. paintEvent() calls paint() for each tab so
87       that any overlap will look right.
88
89       addTab() creates a new tab and adds it to the bar.
90
91       selectTab() decides which tab, if any, the user selects with the mouse.
92
93       The index of the current tab is returned by currentTab(). The tab with
94       a particular index is returned by tabAt(), the tab with a particular id
95       is returned by tab(). The index of a tab is returned by indexOf(). The
96       current tab can be set by index or tab pointer using one of the
97       setCurrentTab() functions.
98
99                                   [Image Omitted]
100
101                                   [Image Omitted]
102
103       See also Advanced Widgets.
104
105   Member Type Documentation

QTabBar::Shape

107       This enum type lists the built-in shapes supported by QTabBar:
108
109       QTabBar::RoundedAbove - the normal rounded look above the pages
110
111       QTabBar::RoundedBelow - the normal rounded look below the pages
112
113       QTabBar::TriangularAbove - triangular tabs above the pages (very
114       unusual; included for completeness)
115
116       QTabBar::TriangularBelow - triangular tabs similar to those used in the
117       Excel spreadsheet, for example
118

MEMBER FUNCTION DOCUMENTATION

QTabBar::QTabBar ( QWidget * parent = 0, const char * name = 0 )

121       Constructs a new, empty tab bar; the parent and name arguments are
122       passed on to the QWidget constructor.
123

QTabBar::~QTabBar ()

125       Destroys the tab control, freeing memory used.
126

int QTabBar::addTab ( QTab * newTab ) [virtual]

128       Adds the tab, newTab, to the tab control.
129
130       Sets newTab's id to a new id and places the tab just to the right of
131       the existing tabs. If the tab's label contains an ampersand, the letter
132       following the ampersand is used as an accelerator for the tab, e.g. if
133       the label is "Bro&wse" then Alt+W becomes an accelerator which will
134       move the focus to this tab. Returns the id.
135
136       See also insertTab().
137

int QTabBar::count () const

139       Returns the number of tabs in the tab bar. See the "count" property for
140       details.
141

int QTabBar::currentTab () const

143       Returns the id of the tab bar's visible tab. See the "currentTab"
144       property for details.
145

int QTabBar::indexOf ( int id ) const

147       Returns the position index of the tab with id id or -1 if no tab has
148       this id.
149
150       See also tabAt().
151

int QTabBar::insertTab ( QTab * newTab, int index = -1 ) [virtual]

153       Inserts the tab, newTab, into the tab control.
154
155       If index is not specified, the tab is simply appended. Otherwise it's
156       inserted at the specified position.
157
158       Sets newTab's id to a new id. If the tab's label contains an ampersand,
159       the letter following the ampersand is used as an accelerator for the
160       tab, e.g. if the label is "Bro&wse" then Alt+W becomes an accelerator
161       which will move the focus to this tab. Returns the id.
162
163       See also addTab().
164

bool QTabBar::isTabEnabled ( int id ) const

166       Returns TRUE if the tab with id id exists and is enabled; otherwise
167       returns FALSE.
168
169       See also setTabEnabled().
170

int QTabBar::keyboardFocusTab () const

172       Returns the id of the tab that has the keyboard focus. See the
173       "keyboardFocusTab" property for details.
174

void QTabBar::layoutChanged () [signal]

176       QTabBar emits the signal whenever the layout of the tab bar has been
177       recalculated, for example when the contents of a tab change.
178

void QTabBar::layoutTabs () [virtual]

180       Lays out all existing tabs according to their label and their iconset.
181

void QTabBar::paint ( QPainter * p, QTab * t, bool selected ) const [virtual

183       protected]
184       Paints the tab t using painter p. If and only if selected is TRUE, t is
185       drawn currently selected.
186
187       This virtual function may be reimplemented to change the look of
188       QTabBar. If you decide to reimplement it, you may also need to
189       reimplement sizeHint().
190

void QTabBar::paintEvent ( QPaintEvent * e ) [virtual protected]

192       Repaints the tab row. All the painting is done by paint(); paintEvent()
193       only decides which tabs need painting and in what order. The event is
194       passed in e.
195
196       See also paint().
197
198       Reimplemented from QWidget.
199

void QTabBar::paintLabel ( QPainter * p, const QRect & br, QTab * t, bool

201       has_focus ) const [virtual protected]
202       Paints the label of tab t centered in rectangle br using painter p. A
203       focus indication is drawn if has_focus is TRUE.
204

void QTabBar::removeTab ( QTab * t ) [virtual]

206       Removes tab t from the tab control, and deletes the tab.
207

void QTabBar::removeToolTip ( int index )

209       Removes the tool tip for the tab at index position index.
210

QTab * QTabBar::selectTab ( const QPoint & p ) const [virtual]

212       This virtual function is called by the mouse event handlers to
213       determine which tab is pressed. The default implementation returns a
214       pointer to the tab whose bounding rectangle contains p, if exactly one
215       tab's bounding rectangle contains p. Otherwise it returns 0.
216
217       See also mousePressEvent() and mouseReleaseEvent().
218

void QTabBar::selected ( int id ) [signal]

220       QTabBar emits this signal whenever any tab is selected, whether by the
221       program or by the user. The argument id is the id of the tab as
222       returned by addTab().
223
224       show() is guaranteed to emit this signal; you can display your page in
225       a slot connected to this signal.
226

void QTabBar::setCurrentTab ( int ) [virtual slot]

228       Sets the id of the tab bar's visible tab. See the "currentTab" property
229       for details.
230

void QTabBar::setCurrentTab ( QTab * tab ) [virtual slot]

232       This is an overloaded member function, provided for convenience. It
233       behaves essentially like the above function.
234
235       Raises tab and emits the selected() signal unless the tab was already
236       current.
237
238       See also currentTab and selected().
239

void QTabBar::setShape ( Shape ) [virtual]

241       Sets the shape of the tabs in the tab bar. See the "shape" property for
242       details.
243

void QTabBar::setTabEnabled ( int id, bool enabled ) [virtual]

245       Enables tab id if enabled is TRUE or disables it if enabled is FALSE.
246       If id is currently selected, setTabEnabled(FALSE) makes another tab
247       selected.
248
249       setTabEnabled() updates the display if this causes a change in id's
250       status.
251
252       See also update() and isTabEnabled().
253

void QTabBar::setToolTip ( int index, const QString & tip )

255       Sets the tool tip for the tab at index position index to tip.
256

Shape QTabBar::shape () const

258       Returns the shape of the tabs in the tab bar. See the "shape" property
259       for details.
260

QTab * QTabBar::tab ( int id ) const

262       Returns the tab with id id or 0 if there is no such tab.
263
264       See also count.
265

QTab * QTabBar::tabAt ( int index ) const

267       Returns the tab at position index.
268
269       See also indexOf().
270

QPtrList<QTab> * QTabBar::tabList () [protected]

272       The list of QTab objects in the tab bar.
273
274       This list is unlikely to be in the order that the QTab elements appear
275       visually. One way of iterating over the tabs is like this:
276
277           for ( uint i = 0; i < myTabBar->count(); ++i ) {
278               nextTab = myTabBar->tabAt( i );
279               // do something with nextTab
280           }
281

QString QTabBar::toolTip ( int index ) const

283       Returns the tool tip for the tab at index position index.
284
285   Property Documentation

int count

287       This property holds the number of tabs in the tab bar.
288
289       Get this property's value with count().
290
291       See also tab().
292

int currentTab

294       This property holds the id of the tab bar's visible tab.
295
296       If no tab page is currently visible, the property's value is -1. Even
297       if the property's value is not -1, you cannot assume that the user can
298       see the relevant page, or that the tab is enabled. When you need to
299       display something the value of this property represents the best page
300       to display.
301
302       When this property is set to id, it will raise the tab with the id id
303       and emit the selected() signal.
304
305       See also selected() and isTabEnabled().
306
307       Set this property's value with setCurrentTab() and get this property's
308       value with currentTab().
309

int keyboardFocusTab

311       This property holds the id of the tab that has the keyboard focus.
312
313       This property contains the id of the tab that has the keyboard focus or
314       -1 if the tab bar does not have the keyboard focus.
315
316       Get this property's value with keyboardFocusTab().
317

Shape shape

319       This property holds the shape of the tabs in the tab bar.
320
321       The value of this property is one of the following: RoundedAbove
322       (default), RoundedBelow, TriangularAbove or TriangularBelow.
323
324       See also Shape.
325
326       Set this property's value with setShape() and get this property's value
327       with shape().
328
329

SEE ALSO

331       http://doc.trolltech.com/qtabbar.html
332       http://www.trolltech.com/faq/tech.html
333
335       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
336       license file included in the distribution for a complete license
337       statement.
338

AUTHOR

340       Generated automatically from the source code.
341

BUGS

343       If you find a bug in Qt, please report it as described in
344       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
345       help you. Thank you.
346
347       The definitive Qt documentation is provided in HTML format; it is
348       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
349       web browser. This man page is provided as a convenience for those users
350       who prefer man pages, although this format is not officially supported
351       by Trolltech.
352
353       If you find errors in this manual page, please report them to qt-
354       bugs@trolltech.com.  Please include the name of the manual page
355       (qtabbar.3qt) and the Qt version (3.3.8).
356
357
358
359Trolltech AS                    2 February 2007                   QTabBar(3qt)
Impressum