1QTabWidget(3qt)                                                QTabWidget(3qt)
2
3
4

NAME

6       QTabWidget - Stack of tabbed widgets
7

SYNOPSIS

9       #include <qtabwidget.h>
10
11       Inherits QWidget.
12
13   Public Members
14       QTabWidget ( QWidget * parent = 0, const char * name = 0, WFlags f = 0
15           )
16       virtual void addTab ( QWidget * child, const QString & label )
17       virtual void addTab ( QWidget * child, const QIconSet & iconset, const
18           QString & label )
19       virtual void addTab ( QWidget * child, QTab * tab )
20       virtual void insertTab ( QWidget * child, const QString & label, int
21           index = -1 )
22       virtual void insertTab ( QWidget * child, const QIconSet & iconset,
23           const QString & label, int index = -1 )
24       virtual void insertTab ( QWidget * child, QTab * tab, int index = -1 )
25       void changeTab ( QWidget * w, const QString & label )
26       void changeTab ( QWidget * w, const QIconSet & iconset, const QString &
27           label )
28       bool isTabEnabled ( QWidget * w ) const
29       void setTabEnabled ( QWidget * w, bool enable )
30       void setCornerWidget ( QWidget * w, Qt::Corner corner = Qt::TopRight )
31       QWidget * cornerWidget ( Qt::Corner corner = Qt::TopRight ) const
32       QString tabLabel ( QWidget * w ) const
33       void setTabLabel ( QWidget * w, const QString & l )
34       QIconSet tabIconSet ( QWidget * w ) const
35       void setTabIconSet ( QWidget * w, const QIconSet & iconset )
36       void removeTabToolTip ( QWidget * w )
37       void setTabToolTip ( QWidget * w, const QString & tip )
38       QString tabToolTip ( QWidget * w ) const
39       QWidget * currentPage () const
40       QWidget * page ( int index ) const
41       QString label ( int index ) const
42       int currentPageIndex () const
43       int indexOf ( QWidget * w ) const
44       enum TabPosition { Top, Bottom }
45       TabPosition tabPosition () const
46       void setTabPosition ( TabPosition )
47       enum TabShape { Rounded, Triangular }
48       TabShape tabShape () const
49       void setTabShape ( TabShape s )
50       int margin () const
51       void setMargin ( int )
52       int count () const
53
54   Public Slots
55       void setCurrentPage ( int )
56       virtual void showPage ( QWidget * w )
57       virtual void removePage ( QWidget * w )
58
59   Signals
60       void currentChanged ( QWidget * )
61
62   Properties
63       bool autoMask - whether the tab widget is automatically masked  (read
64           only)
65       int count - the number of tabs in the tab bar  (read only)
66       int currentPage - the index position of the current tab page
67       int margin - the margin in this tab widget
68       TabPosition tabPosition - the position of the tabs in this tab widget
69       TabShape tabShape - the shape of the tabs in this tab widget
70
71   Protected Members
72       void setTabBar ( QTabBar * tb )
73       QTabBar * tabBar () const
74

DESCRIPTION

76       The QTabWidget class provides a stack of tabbed widgets.
77
78       A tab widget provides a tab bar of tabs and a `page area' below (or
79       above, see TabPosition) the tabs. Each tab is associated with a
80       different widget (called a `page'). Only the current tab's page is
81       shown in the page area; all the other tabs' pages are hidden. The user
82       can show a different page by clicking on its tab or by pressing its
83       Alt+letter accelerator if it has one.
84
85       The normal way to use QTabWidget is to do the following in the
86       constructor: <ol type=1>
87
88       1      Create a QTabWidget.
89
90       2      Create a QWidget for each of the pages in the tab dialog, insert
91              children into it, set up geometry management for it and use
92              addTab() (or insertTab()) to set up a tab and keyboard
93              accelerator for it.
94
95       3      Connect to the signals and slots.
96
97       The position of the tabs is set with setTabPosition(), their shape with
98       setTabShape(), and their margin with setMargin().
99
100       If you don't call addTab() and the QTabWidget is already visible, then
101       the page you have created will not be visible. Don't confuse the object
102       name you supply to the QWidget constructor and the tab label you supply
103       to addTab(). addTab() takes a name which indicates an accelerator and
104       is meaningful and descriptive to the user, whereas the widget name is
105       used primarily for debugging.
106
107       The signal currentChanged() is emitted when the user selects a page.
108
109       The current page is available as an index position with
110       currentPageIndex() or as a wiget pointer with currentPage(). You can
111       retrieve a pointer to a page with a given index using page(), and can
112       find the index position of a page with indexOf(). Use setCurrentPage()
113       to show a particular page by index, or showPage() to show a page by
114       widget pointer.
115
116       You can change a tab's label and iconset using changeTab() or
117       setTabLabel() and setTabIconSet(). A tab page can be removed with
118       removePage().
119
120       Each tab is either enabled or disabled at any given time (see
121       setTabEnabled()). If a tab is enabled, the tab text is drawn normally
122       and the user can select that tab. If it is disabled, the tab is drawn
123       in a different way and the user cannot select that tab. Note that even
124       if a tab is disabled, the page can still be visible, for example if all
125       of the tabs happen to be disabled.
126
127       Although tab widgets can be a very good way to split up a complex
128       dialog, it's also very easy to get into a mess. See QTabDialog for some
129       design hints. An alternative is to use a QWidgetStack for which you
130       provide some means of navigating between pages, for example, a QToolBar
131       or a QListBox.
132
133       Most of the functionality in QTabWidget is provided by a QTabBar (at
134       the top, providing the tabs) and a QWidgetStack (most of the area,
135       organizing the individual pages).
136
137                                   [Image Omitted]
138
139                                   [Image Omitted]
140
141       See also QTabDialog, QToolBox, Advanced Widgets, and Organizers.
142
143   Member Type Documentation

QTabWidget::TabPosition

145       This enum type defines where QTabWidget draws the tab row:
146
147       QTabWidget::Top - above the pages
148
149       QTabWidget::Bottom - below the pages
150

QTabWidget::TabShape

152       This enum type defines the shape of the tabs:
153
154       QTabWidget::Rounded - rounded look (normal)
155
156       QTabWidget::Triangular - triangular look (very unusual, included for
157       completeness)
158

MEMBER FUNCTION DOCUMENTATION

QTabWidget::QTabWidget ( QWidget * parent = 0, const char * name = 0, WFlags f

161       = 0 )
162       Constructs a tabbed widget called name with parent parent, and widget
163       flags f.
164

void QTabWidget::addTab ( QWidget * child, const QString & label ) [virtual]

166       Adds another tab and page to the tab view.
167
168       The new page is child; the tab's label is label. Note the difference
169       between the widget name (which you supply to widget constructors and to
170       setTabEnabled(), for example) and the tab label. The name is internal
171       to the program and invariant, whereas the label is shown on-screen and
172       may vary according to language and other factors.
173
174       If the tab's label contains an ampersand, the letter following the
175       ampersand is used as an accelerator for the tab, e.g. if the label is
176       "Bro&wse" then Alt+W becomes an accelerator which will move the focus
177       to this tab.
178
179       If you call addTab() after show() the screen will flicker and the user
180       may be confused.
181
182       Adding the same child twice will have undefined behavior.
183
184       See also insertTab().
185
186       Examples:
187

void QTabWidget::addTab ( QWidget * child, const QIconSet & iconset, const

189       QString & label ) [virtual]
190       This is an overloaded member function, provided for convenience. It
191       behaves essentially like the above function.
192
193       Adds another tab and page to the tab view.
194
195       This function is the same as addTab(), but with an additional iconset.
196

void QTabWidget::addTab ( QWidget * child, QTab * tab ) [virtual]

198       This is an overloaded member function, provided for convenience. It
199       behaves essentially like the above function.
200
201       This is a low-level function for adding tabs. It is useful if you are
202       using setTabBar() to set a QTabBar subclass with an overridden
203       QTabBar::paint() function for a subclass of QTab. The child is the new
204       page and tab is the tab to put the child on.
205

void QTabWidget::changeTab ( QWidget * w, const QString & label )

207       Defines a new label for page w's tab.
208

void QTabWidget::changeTab ( QWidget * w, const QIconSet & iconset, const

210       QString & label )
211       This is an overloaded member function, provided for convenience. It
212       behaves essentially like the above function.
213
214       Defines a new iconset and a new label for page w's tab.
215

QWidget * QTabWidget::cornerWidget ( Qt::Corner corner = Qt::TopRight ) const

217       Returns the widget shown in the corner of the tab widget or 0.
218

int QTabWidget::count () const

220       Returns the number of tabs in the tab bar. See the "count" property for
221       details.
222

void QTabWidget::currentChanged ( QWidget * ) [signal]

224       This signal is emitted whenever the current page changes. The parameter
225       is the new current page.
226
227       See also currentPage(), showPage(), and tabLabel().
228

QWidget * QTabWidget::currentPage () const

230       Returns a pointer to the page currently being displayed by the tab
231       dialog. The tab dialog does its best to make sure that this value is
232       never 0 (but if you try hard enough, it can be).
233

int QTabWidget::currentPageIndex () const

235       Returns the index position of the current tab page. See the
236       "currentPage" property for details.
237

int QTabWidget::indexOf ( QWidget * w ) const

239       Returns the index position of page w, or -1 if the widget cannot be
240       found.
241

void QTabWidget::insertTab ( QWidget * child, const QString & label, int index

243       = -1 ) [virtual]
244       Inserts another tab and page to the tab view.
245
246       The new page is child; the tab's label is label. Note the difference
247       between the widget name (which you supply to widget constructors and to
248       setTabEnabled(), for example) and the tab label. The name is internal
249       to the program and invariant, whereas the label is shown on-screen and
250       may vary according to language and other factors.
251
252       If the tab's label contains an ampersand, the letter following the
253       ampersand is used as an accelerator for the tab, e.g. if the label is
254       "Bro&wse" then Alt+W becomes an accelerator which will move the focus
255       to this tab.
256
257       If index is not specified, the tab is simply appended. Otherwise it is
258       inserted at the specified position.
259
260       If you call insertTab() after show(), the screen will flicker and the
261       user may be confused.
262
263       See also addTab().
264

void QTabWidget::insertTab ( QWidget * child, const QIconSet & iconset, const

266       QString & label, int index = -1 ) [virtual]
267       This is an overloaded member function, provided for convenience. It
268       behaves essentially like the above function.
269
270       Inserts another tab and page to the tab view.
271
272       This function is the same as insertTab(), but with an additional
273       iconset.
274

void QTabWidget::insertTab ( QWidget * child, QTab * tab, int index = -1 )

276       [virtual]
277       This is an overloaded member function, provided for convenience. It
278       behaves essentially like the above function.
279
280       This is a lower-level method for inserting tabs, similar to the other
281       insertTab() method. It is useful if you are using setTabBar() to set a
282       QTabBar subclass with an overridden QTabBar::paint() function for a
283       subclass of QTab. The child is the new page, tab is the tab to put the
284       child on and index is the position in the tab bar that this page should
285       occupy.
286

bool QTabWidget::isTabEnabled ( QWidget * w ) const

288       Returns TRUE if the page w is enabled; otherwise returns FALSE.
289
290       See also setTabEnabled() and QWidget::enabled.
291

QString QTabWidget::label ( int index ) const

293       Returns the label of the tab at index position index or QString::null
294       if the index is out of range.
295

int QTabWidget::margin () const

297       Returns the margin in this tab widget. See the "margin" property for
298       details.
299

QWidget * QTabWidget::page ( int index ) const

301       Returns the tab page at index position index or 0 if the index is out
302       of range.
303

void QTabWidget::removePage ( QWidget * w ) [virtual slot]

305       Removes page w from this stack of widgets. Does not delete w.
306
307       See also addTab(), showPage(), and QWidgetStack::removeWidget().
308

void QTabWidget::removeTabToolTip ( QWidget * w )

310       Removes the tab tool tip for page w. If the page does not have a tip,
311       nothing happens.
312
313       See also setTabToolTip() and tabToolTip().
314

void QTabWidget::setCornerWidget ( QWidget * w, Qt::Corner corner =

316       Qt::TopRight )
317       Sets widget w to be the shown in the specified corner of the tab
318       widget.
319
320       Only the horizontal element of the corner will be used.
321
322       See also cornerWidget() and tabPosition.
323

void QTabWidget::setCurrentPage ( int ) [slot]

325       Sets the index position of the current tab page. See the "currentPage"
326       property for details.
327

void QTabWidget::setMargin ( int )

329       Sets the margin in this tab widget. See the "margin" property for
330       details.
331

void QTabWidget::setTabBar ( QTabBar * tb ) [protected]

333       Replaces the dialog's QTabBar heading with the tab bar tb. Note that
334       this must be called before any tabs have been added, or the behavior is
335       undefined.
336
337       See also tabBar().
338

void QTabWidget::setTabEnabled ( QWidget * w, bool enable )

340       If enable is TRUE, page w is enabled; otherwise page w is disabled. The
341       page's tab is redrawn appropriately.
342
343       QTabWidget uses QWidget::setEnabled() internally, rather than keeping a
344       separate flag.
345
346       Note that even a disabled tab/page may be visible. If the page is
347       visible already, QTabWidget will not hide it; if all the pages are
348       disabled, QTabWidget will show one of them.
349
350       See also isTabEnabled() and QWidget::enabled.
351

void QTabWidget::setTabIconSet ( QWidget * w, const QIconSet & iconset )

353       Sets the iconset for page w to iconset.
354

void QTabWidget::setTabLabel ( QWidget * w, const QString & l )

356       Sets the tab label for page w to l
357

void QTabWidget::setTabPosition ( TabPosition )

359       Sets the position of the tabs in this tab widget. See the "tabPosition"
360       property for details.
361

void QTabWidget::setTabShape ( TabShape s )

363       Sets the shape of the tabs in this tab widget to s. See the "tabShape"
364       property for details.
365

void QTabWidget::setTabToolTip ( QWidget * w, const QString & tip )

367       Sets the tab tool tip for page w to tip.
368
369       See also removeTabToolTip() and tabToolTip().
370

void QTabWidget::showPage ( QWidget * w ) [virtual slot]

372       Ensures that page w is shown. This is useful mainly for accelerators.
373
374       Warning: Used carelessly, this function can easily surprise or confuse
375       the user.
376
377       See also QTabBar::currentTab.
378

QTabBar * QTabWidget::tabBar () const [protected]

380       Returns the current QTabBar.
381
382       See also setTabBar().
383

QIconSet QTabWidget::tabIconSet ( QWidget * w ) const

385       Returns the iconset of page w or a null iconset if w is not a tab page
386       or does not have an iconset.
387

QString QTabWidget::tabLabel ( QWidget * w ) const

389       Returns the label text for the tab on page w.
390

TabPosition QTabWidget::tabPosition () const

392       Returns the position of the tabs in this tab widget. See the
393       "tabPosition" property for details.
394

TabShape QTabWidget::tabShape () const

396       Returns the shape of the tabs in this tab widget. See the "tabShape"
397       property for details.
398

QString QTabWidget::tabToolTip ( QWidget * w ) const

400       Returns the tab tool tip for page w or QString::null if no tool tip has
401       been set.
402
403       See also setTabToolTip() and removeTabToolTip().
404
405   Property Documentation

bool autoMask

407       This property holds whether the tab widget is automatically masked.
408
409       See also QWidget::autoMask.
410

int count

412       This property holds the number of tabs in the tab bar.
413
414       Get this property's value with count().
415

int currentPage

417       This property holds the index position of the current tab page.
418
419       Set this property's value with setCurrentPage() and get this property's
420       value with currentPageIndex().
421
422       See also QTabBar::currentTab.
423

int margin

425       This property holds the margin in this tab widget.
426
427       The margin is the distance between the innermost pixel of the frame and
428       the outermost pixel of the pages.
429
430       Set this property's value with setMargin() and get this property's
431       value with margin().
432

TabPosition tabPosition

434       This property holds the position of the tabs in this tab widget.
435
436       Possible values for this property are QTabWidget::Top and
437       QTabWidget::Bottom.
438
439       See also TabPosition.
440
441       Set this property's value with setTabPosition() and get this property's
442       value with tabPosition().
443

TabShape tabShape

445       This property holds the shape of the tabs in this tab widget.
446
447       Possible values for this property are QTabWidget::Rounded (default) or
448       QTabWidget::Triangular.
449
450       See also TabShape.
451
452       Set this property's value with setTabShape() and get this property's
453       value with tabShape().
454
455

SEE ALSO

457       http://doc.trolltech.com/qtabwidget.html
458       http://www.trolltech.com/faq/tech.html
459
461       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
462       license file included in the distribution for a complete license
463       statement.
464

AUTHOR

466       Generated automatically from the source code.
467

BUGS

469       If you find a bug in Qt, please report it as described in
470       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
471       help you. Thank you.
472
473       The definitive Qt documentation is provided in HTML format; it is
474       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
475       web browser. This man page is provided as a convenience for those users
476       who prefer man pages, although this format is not officially supported
477       by Trolltech.
478
479       If you find errors in this manual page, please report them to qt-
480       bugs@trolltech.com.  Please include the name of the manual page
481       (qtabwidget.3qt) and the Qt version (3.3.8).
482
483
484
485Trolltech AS                    2 February 2007                QTabWidget(3qt)
Impressum