1QTabDialog(3qt) QTabDialog(3qt)
2
3
4
6 QTabDialog - Stack of tabbed widgets
7
9 #include <qtabdialog.h>
10
11 Inherits QDialog.
12
13 Public Members
14 QTabDialog ( QWidget * parent = 0, const char * name = 0, bool modal =
15 FALSE, WFlags f = 0 )
16 ~QTabDialog ()
17 virtual void setFont ( const QFont & font )
18 void addTab ( QWidget * child, const QString & label )
19 void addTab ( QWidget * child, const QIconSet & iconset, const QString
20 & label )
21 void addTab ( QWidget * child, QTab * tab )
22 void insertTab ( QWidget * child, const QString & label, int index = -1
23 )
24 void insertTab ( QWidget * child, const QIconSet & iconset, const
25 QString & label, int index = -1 )
26 void insertTab ( QWidget * child, QTab * tab, int index = -1 )
27 void changeTab ( QWidget * w, const QString & label )
28 void changeTab ( QWidget * w, const QIconSet & iconset, const QString &
29 label )
30 bool isTabEnabled ( QWidget * w ) const
31 void setTabEnabled ( QWidget * w, bool enable )
32 bool isTabEnabled ( const char * name ) const (obsolete)
33 void setTabEnabled ( const char * name, bool enable ) (obsolete)
34 void showPage ( QWidget * w )
35 void removePage ( QWidget * w )
36 QString tabLabel ( QWidget * w )
37 QWidget * currentPage () const
38 void setDefaultButton ( const QString & text )
39 void setDefaultButton ()
40 bool hasDefaultButton () const
41 void setHelpButton ( const QString & text )
42 void setHelpButton ()
43 bool hasHelpButton () const
44 void setCancelButton ( const QString & text )
45 void setCancelButton ()
46 bool hasCancelButton () const
47 void setApplyButton ( const QString & text )
48 void setApplyButton ()
49 bool hasApplyButton () const
50 void setOkButton ( const QString & text )
51 void setOkButton ()
52 bool hasOkButton () const
53
54 Signals
55 void aboutToShow ()
56 void applyButtonPressed ()
57 void cancelButtonPressed ()
58 void defaultButtonPressed ()
59 void helpButtonPressed ()
60 void currentChanged ( QWidget * )
61 void selected ( const QString & ) (obsolete)
62
63 Protected Members
64 void setTabBar ( QTabBar * tb )
65 QTabBar * tabBar () const
66
68 The QTabDialog class provides a stack of tabbed widgets.
69
70 A tabbed dialog is one in which several "tab pages" are available. By
71 clicking on a tab page's tab or by pressing the indicated Alt+letter
72 key combination, the user can select which tab page they want to use.
73
74 QTabDialog provides a tab bar consisting of single row of tabs at the
75 top; each tab has an associated widget which is that tab's tab page. In
76 addition, QTabDialog provides an OK button and the following optional
77 buttons: Apply, Cancel, Defaults and Help.
78
79 The normal way to use QTabDialog is to do the following in the
80 constructor: <ol type=1>
81
82 1 Create a QTabDialog.
83
84 2 Create a QWidget for each of the pages in the tab dialog, insert
85 children into it, set up geometry management for it, and use
86 addTab() (or insertTab()) to set up a tab and keyboard
87 accelerator for it.
88
89 3 Set up the buttons for the tab dialog using setOkButton(),
90 setApplyButton(), setDefaultsButton(), setCancelButton() and
91 setHelpButton().
92
93 4 Connect to the signals and slots.
94
95 If you don't call addTab() the page you have created will not be
96 visible. Don't confuse the object name you supply to the QWidget
97 constructor and the tab label you supply to addTab(); addTab() takes
98 user-visible name that appears on the widget's tab and may identify an
99 accelerator, whereas the widget name is used primarily for debugging.
100
101 Almost all applications have to connect the applyButtonPressed() signal
102 to something. applyButtonPressed() is emitted when either OK or Apply
103 is clicked, and your slot must copy the dialog's state into the
104 application.
105
106 There are also several other signals which may be useful:
107
108 cancelButtonPressed() is emitted when the user clicks Cancel.
109
110 defaultButtonPressed() is emitted when the user clicks Defaults; the
111 slot it is connected to should reset the state of the dialog to the
112 application defaults.
113
114 helpButtonPressed() is emitted when the user clicks Help.
115
116 aboutToShow() is emitted at the start of show(); if there is any chance
117 that the state of the application may change between the creation of
118 the tab dialog and the time show() is called, you must connect this
119 signal to a slot that resets the state of the dialog.
120
121 currentChanged() is emitted when the user selects a page.
122
123 Each tab is either enabled or disabled at any given time (see
124 setTabEnabled()). If a tab is enabled the tab text is drawn in black
125 and the user can select that tab. If it is disabled the tab is drawn in
126 a different way and the user cannot select that tab. Note that even if
127 a tab is disabled, the page can still be visible; for example, if all
128 of the tabs happen to be disabled.
129
130 You can change a tab's label and iconset using changeTab(). A tab page
131 can be removed with removePage() and shown with showPage(). The current
132 page is given by currentPage().
133
134 QTabDialog does not support tabs on the sides or bottom, nor can you
135 set or retrieve the visible page. If you need more functionality than
136 QTabDialog provides, consider creating a QDialog and using a QTabBar
137 with QTabWidgets.
138
139 Most of the functionality in QTabDialog is provided by a QTabWidget.
140
141 [Image Omitted]
142
143 [Image Omitted]
144
145 See also QDialog and Dialog Classes.
146
149 modal = FALSE, WFlags f = 0 )
150 Constructs a QTabDialog with only an OK button. The parent, name, modal
151 and widget flag, f, arguments are passed on to the QDialog constructor.
152
154 Destroys the tab dialog.
155
157 This signal is emitted by show() when it is time to set the state of
158 the dialog's contents. The dialog should reflect the current state of
159 the application when it appears; if there is any possibility that the
160 state of the application may change between the time you call
161 QTabDialog::QTabDialog() and QTabDialog::show(), you should set the
162 dialog's state in a slot and connect this signal to it.
163
164 This applies mainly to QTabDialog objects that are kept around hidden,
165 rather than being created, shown, and deleted afterwards.
166
167 See also applyButtonPressed(), show(), and cancelButtonPressed().
168
170 Adds another tab and page to the tab view.
171
172 The new page is child; the tab's label is label. Note the difference
173 between the widget name (which you supply to widget constructors and to
174 setTabEnabled(), for example) and the tab label. The name is internal
175 to the program and invariant, whereas the label is shown on-screen and
176 may vary according to language and other factors.
177
178 If the tab's label contains an ampersand, the letter following the
179 ampersand is used as an accelerator for the tab, e.g. if the label is
180 "Bro&wse" then Alt+W becomes an accelerator which will move the focus
181 to this tab.
182
183 If you call addTab() after show() the screen will flicker and the user
184 may be confused.
185
186 See also insertTab().
187
189 QString & label )
190 This is an overloaded member function, provided for convenience. It
191 behaves essentially like the above function.
192
193 This version of the function shows the iconset as well as the label on
194 the tab of child.
195
197 This is an overloaded member function, provided for convenience. It
198 behaves essentially like the above function.
199
200 This is a lower-level method for adding tabs, similar to the other
201 addTab() method. It is useful if you are using setTabBar() to set a
202 QTabBar subclass with an overridden QTabBar::paint() function for a
203 subclass of QTab.
204
205 The child is the widget to be placed on the new tab page. The tab is
206 the tab to display on the tab page -- normally this shows a label or an
207 icon that identifies the tab page.
208
210 This signal is emitted when either the Apply or OK button is clicked.
211
212 It should be connected to a slot (or several slots) that change the
213 application's state according to the state of the dialog.
214
215 See also cancelButtonPressed(), defaultButtonPressed(), and
216 setApplyButton().
217
219 This signal is emitted when the Cancel button is clicked. It is
220 automatically connected to QDialog::reject(), which will hide the
221 dialog.
222
223 The Cancel button should not change the application's state at all, so
224 you should generally not need to connect it to any slot.
225
226 See also applyButtonPressed(), defaultButtonPressed(), and
227 setCancelButton().
228
230 QString & label )
231 Changes tab page w's iconset to iconset and label to label.
232
234 This is an overloaded member function, provided for convenience. It
235 behaves essentially like the above function.
236
237 Defines a new label for the tab of page w
238
240 This signal is emitted whenever the current page changes.
241
242 See also currentPage(), showPage(), and tabLabel().
243
245 Returns a pointer to the page currently being displayed by the tab
246 dialog. The tab dialog does its best to make sure that this value is
247 never 0 (but if you try hard enough, it can be).
248
250 This signal is emitted when the Defaults button is pressed. It should
251 reset the dialog (but not the application) to the "factory defaults".
252
253 The application's state should not be changed until the user clicks
254 Apply or OK.
255
256 See also applyButtonPressed(), cancelButtonPressed(), and
257 setDefaultButton().
258
260 Returns TRUE if the tab dialog has an Apply button; otherwise returns
261 FALSE.
262
263 See also setApplyButton(), applyButtonPressed(), hasCancelButton(), and
264 hasDefaultButton().
265
267 Returns TRUE if the tab dialog has a Cancel button; otherwise returns
268 FALSE.
269
270 See also setCancelButton(), cancelButtonPressed(), hasApplyButton(),
271 and hasDefaultButton().
272
274 Returns TRUE if the tab dialog has a Defaults button; otherwise returns
275 FALSE.
276
277 See also setDefaultButton(), defaultButtonPressed(), hasApplyButton(),
278 and hasCancelButton().
279
281 Returns TRUE if the tab dialog has a Help button; otherwise returns
282 FALSE.
283
284 See also setHelpButton(), helpButtonPressed(), hasApplyButton(), and
285 hasCancelButton().
286
288 Returns TRUE if the tab dialog has an OK button; otherwise returns
289 FALSE.
290
291 See also setOkButton(), hasApplyButton(), hasCancelButton(), and
292 hasDefaultButton().
293
295 This signal is emitted when the Help button is pressed. It could be
296 used to present information about how to use the dialog.
297
298 See also applyButtonPressed(), cancelButtonPressed(), and
299 setHelpButton().
300
302 = -1 )
303 Inserts another tab and page to the tab view.
304
305 The new page is child; the tab's label is label. Note the difference
306 between the widget name (which you supply to widget constructors and to
307 setTabEnabled(), for example) and the tab label. The name is internal
308 to the program and invariant, whereas the label is shown on-screen and
309 may vary according to language and other factors.
310
311 If the tab's label contains an ampersand, the letter following the
312 ampersand is used as an accelerator for the tab, e.g. if the label is
313 "Bro&wse" then Alt+W becomes an accelerator which will move the focus
314 to this tab.
315
316 If index is not specified, the tab is simply added. Otherwise it is
317 inserted at the specified position.
318
319 If you call insertTab() after show(), the screen will flicker and the
320 user may be confused.
321
322 See also addTab().
323
325 QString & label, int index = -1 )
326 This is an overloaded member function, provided for convenience. It
327 behaves essentially like the above function.
328
329 This version of the function shows the iconset as well as the label on
330 the tab of child.
331
333 This is an overloaded member function, provided for convenience. It
334 behaves essentially like the above function.
335
336 This is a lower-level method for inserting tabs, similar to the other
337 insertTab() method. It is useful if you are using setTabBar() to set a
338 QTabBar subclass with an overridden QTabBar::paint() function for a
339 subclass of QTab.
340
341 The child is the widget to be placed on the new tab page. The tab is
342 the tab to display on the tab page -- normally this shows a label or an
343 icon that identifies the tab page. The index is the position where this
344 tab page should be inserted.
345
347 Returns TRUE if the page w is enabled; otherwise returns FALSE.
348
349 See also setTabEnabled() and QWidget::enabled.
350
352 This function is obsolete. It is provided to keep old source working.
353 We strongly advise against using it in new code.
354
355 Returns TRUE if the page with object name name is enabled and FALSE if
356 it is disabled.
357
358 If name is 0 or not the name of any of the pages, isTabEnabled()
359 returns FALSE.
360
361 See also setTabEnabled() and QWidget::enabled.
362
364 Removes page w from this stack of widgets. Does not delete w.
365
366 See also showPage(), QTabWidget::removePage(), and
367 QWidgetStack::removeWidget().
368
370 This function is obsolete. It is provided to keep old source working.
371 We strongly advise against using it in new code.
372
373 This signal is emitted whenever a tab is selected (raised), including
374 during the first show().
375
376 See also raise().
377
379 Adds an Apply button to the dialog. The button's text is set to text.
380
381 The Apply button should apply the current settings in the dialog box to
382 the application while keeping the dialog visible.
383
384 When Apply is clicked, the applyButtonPressed() signal is emitted.
385
386 If text is a null string, no button is shown.
387
388 See also setCancelButton(), setDefaultButton(), and
389 applyButtonPressed().
390
392 This is an overloaded member function, provided for convenience. It
393 behaves essentially like the above function.
394
395 Adds an Apply button to the dialog. The button's text is set to a
396 localizable "Apply".
397
399 Adds a Cancel button to the dialog. The button's text is set to text.
400
401 The cancel button should always return the application to the state it
402 was in before the tab view popped up, or if the user has clicked Apply,
403 back to the state immediately after the last Apply.
404
405 When Cancel is clicked, the cancelButtonPressed() signal is emitted.
406 The dialog is closed at the same time.
407
408 If text is a null string, no button is shown.
409
410 See also setApplyButton(), setDefaultButton(), and
411 cancelButtonPressed().
412
414 This is an overloaded member function, provided for convenience. It
415 behaves essentially like the above function.
416
417 Adds a Cancel button to the dialog. The button's text is set to a
418 localizable "Cancel".
419
421 Adds a Defaults button to the dialog. The button's text is set to text.
422
423 The Defaults button should set the dialog (but not the application)
424 back to the application defaults.
425
426 When Defaults is clicked, the defaultButtonPressed() signal is emitted.
427
428 If text is a null string, no button is shown.
429
430 See also setApplyButton(), setCancelButton(), and
431 defaultButtonPressed().
432
434 This is an overloaded member function, provided for convenience. It
435 behaves essentially like the above function.
436
437 Adds a Defaults button to the dialog. The button's text is set to a
438 localizable "Defaults".
439
441 Sets the font for the tabs to font.
442
443 If the widget is visible, the display is updated with the new font
444 immediately. There may be some geometry changes, depending on the size
445 of the old and new fonts.
446
447 Reimplemented from QWidget.
448
450 Adds a Help button to the dialog. The button's text is set to text.
451
452 When Help is clicked, the helpButtonPressed() signal is emitted.
453
454 If text is a null string, no button is shown.
455
456 See also setApplyButton(), setCancelButton(), and helpButtonPressed().
457
459 This is an overloaded member function, provided for convenience. It
460 behaves essentially like the above function.
461
462 Adds a Help button to the dialog. The button's text is set to a
463 localizable "Help".
464
466 Adds an OK button to the dialog and sets the button's text to text.
467
468 When the OK button is clicked, the applyButtonPressed() signal is
469 emitted, and the current settings in the dialog box should be applied
470 to the application. The dialog then closes.
471
472 If text is a null string, no button is shown.
473
474 See also setCancelButton(), setDefaultButton(), and
475 applyButtonPressed().
476
478 This is an overloaded member function, provided for convenience. It
479 behaves essentially like the above function.
480
481 Adds an OK button to the dialog. The button's text is set to a
482 localizable "OK".
483
485 Replaces the QTabBar heading the dialog by the given tab bar, tb. Note
486 that this must be called before any tabs have been added, or the
487 behavior is undefined.
488
489 See also tabBar().
490
492 If enable is TRUE the page w is enabled; otherwise w is disabled. The
493 page's tab is redrawn appropriately.
494
495 QTabWidget uses QWidget::setEnabled() internally, rather than keeping a
496 separate flag.
497
498 Note that even a disabled tab and tab page may be visible. If the page
499 is already visible QTabWidget will not hide it; if all the pages are
500 disabled QTabWidget will show one of them.
501
502 See also isTabEnabled() and QWidget::enabled.
503
505 This function is obsolete. It is provided to keep old source working.
506 We strongly advise against using it in new code.
507
508 Finds the page with object name name, enables/disables it according to
509 the value of enable and redraws the page's tab appropriately.
510
511 QTabDialog uses QWidget::setEnabled() internally, rather than keeping a
512 separate flag.
513
514 Note that even a disabled tab/page may be visible. If the page is
515 already visible QTabDialog will not hide it; if all the pages are
516 disabled QTabDialog will show one of them.
517
518 The object name is used (rather than the tab label) because the tab
519 text may not be invariant in multi-language applications.
520
521 See also isTabEnabled() and QWidget::enabled.
522
524 Ensures that widget w is shown. This is mainly useful for accelerators.
525
526 Warning: If used carelessly, this function can easily surprise or
527 confuse the user.
528
529 See also QTabBar::currentTab.
530
532 Returns the currently set QTabBar.
533
534 See also setTabBar().
535
537 Returns the text in the tab for page w.
538
539
541 http://doc.trolltech.com/qtabdialog.html
542 http://www.trolltech.com/faq/tech.html
543
545 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
546 license file included in the distribution for a complete license
547 statement.
548
550 Generated automatically from the source code.
551
553 If you find a bug in Qt, please report it as described in
554 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
555 help you. Thank you.
556
557 The definitive Qt documentation is provided in HTML format; it is
558 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
559 web browser. This man page is provided as a convenience for those users
560 who prefer man pages, although this format is not officially supported
561 by Trolltech.
562
563 If you find errors in this manual page, please report them to qt-
564 bugs@trolltech.com. Please include the name of the manual page
565 (qtabdialog.3qt) and the Qt version (3.3.8).
566
567
568
569Trolltech AS 2 February 2007 QTabDialog(3qt)