📄 qtabdialog.3qt
字号:
'\" t.TH QTabDialog 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQTabDialog \- Stack of tabbed widgets.SH SYNOPSIS\fC#include <qtabdialog.h>\fR.PPInherits QDialog..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQTabDialog\fR ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )".br.ti -1c.BI "\fB~QTabDialog\fR ()".br.ti -1c.BI "virtual void \fBsetFont\fR ( const QFont & font )".br.ti -1c.BI "void \fBaddTab\fR ( QWidget * child, const QString & label )".br.ti -1c.BI "void \fBaddTab\fR ( QWidget * child, const QIconSet & iconset, const QString & label )".br.ti -1c.BI "void \fBaddTab\fR ( QWidget * child, QTab * tab )".br.ti -1c.BI "void \fBinsertTab\fR ( QWidget * child, const QString & label, int index = -1 )".br.ti -1c.BI "void \fBinsertTab\fR ( QWidget * child, const QIconSet & iconset, const QString & label, int index = -1 )".br.ti -1c.BI "void \fBinsertTab\fR ( QWidget * child, QTab * tab, int index = -1 )".br.ti -1c.BI "void \fBchangeTab\fR ( QWidget * w, const QString & label )".br.ti -1c.BI "void \fBchangeTab\fR ( QWidget * w, const QIconSet & iconset, const QString & label )".br.ti -1c.BI "bool \fBisTabEnabled\fR ( QWidget * w ) const".br.ti -1c.BI "void \fBsetTabEnabled\fR ( QWidget * w, bool enable )".br.ti -1c.BI "bool isTabEnabled ( const char * name ) const \fI(obsolete)\fR".br.ti -1c.BI "void setTabEnabled ( const char * name, bool enable ) \fI(obsolete)\fR".br.ti -1c.BI "void \fBshowPage\fR ( QWidget * w )".br.ti -1c.BI "void \fBremovePage\fR ( QWidget * w )".br.ti -1c.BI "QString \fBtabLabel\fR ( QWidget * w )".br.ti -1c.BI "QWidget * \fBcurrentPage\fR () const".br.ti -1c.BI "void \fBsetDefaultButton\fR ( const QString & text )".br.ti -1c.BI "void \fBsetDefaultButton\fR ()".br.ti -1c.BI "bool \fBhasDefaultButton\fR () const".br.ti -1c.BI "void \fBsetHelpButton\fR ( const QString & text )".br.ti -1c.BI "void \fBsetHelpButton\fR ()".br.ti -1c.BI "bool \fBhasHelpButton\fR () const".br.ti -1c.BI "void \fBsetCancelButton\fR ( const QString & text )".br.ti -1c.BI "void \fBsetCancelButton\fR ()".br.ti -1c.BI "bool \fBhasCancelButton\fR () const".br.ti -1c.BI "void \fBsetApplyButton\fR ( const QString & text )".br.ti -1c.BI "void \fBsetApplyButton\fR ()".br.ti -1c.BI "bool \fBhasApplyButton\fR () const".br.ti -1c.BI "void \fBsetOkButton\fR ( const QString & text )".br.ti -1c.BI "void \fBsetOkButton\fR ()".br.ti -1c.BI "bool \fBhasOkButton\fR () const".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBaboutToShow\fR ()".br.ti -1c.BI "void \fBapplyButtonPressed\fR ()".br.ti -1c.BI "void \fBcancelButtonPressed\fR ()".br.ti -1c.BI "void \fBdefaultButtonPressed\fR ()".br.ti -1c.BI "void \fBhelpButtonPressed\fR ()".br.ti -1c.BI "void \fBcurrentChanged\fR ( QWidget * )".br.ti -1c.BI "void selected ( const QString & ) \fI(obsolete)\fR".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetTabBar\fR ( QTabBar * tb )".br.ti -1c.BI "QTabBar * \fBtabBar\fR () const".br.in -1c.SH DESCRIPTIONThe QTabDialog class provides a stack of tabbed widgets..PPA tabbed dialog is one in which several "tab pages" are available. By clicking on a tab page's tab or by pressing the indicated Alt+\fIletter\fR key combination, the user can select which tab page they want to use..PPQTabDialog provides a tab bar consisting of single row of tabs at the top; each tab has an associated widget which is that tab's tab page. In addition, QTabDialog provides an OK button and the following optional buttons: Apply, Cancel, Defaults and Help..PPThe normal way to use QTabDialog is to do the following in the constructor: <ol type=1>.IP 1Create a QTabDialog..IP 2Create a QWidget for each of the pages in the tab dialog, insert children into it, set up geometry management for it, and use addTab() (or insertTab()) to set up a tab and keyboard accelerator for it..IP 3Set up the buttons for the tab dialog using setOkButton(), setApplyButton(), setDefaultsButton(), setCancelButton() and setHelpButton()..IP 4Connect to the signals and slots..PPIf you don't call addTab() the page you have created will not be visible. Don't confuse the object name you supply to the QWidget constructor and the tab label you supply to addTab(); addTab() takes user-visible name that appears on the widget's tab and may identify an accelerator, whereas the widget name is used primarily for debugging..PPAlmost all applications have to connect the applyButtonPressed() signal to something. applyButtonPressed() is emitted when either OK or Apply is clicked, and your slot must copy the dialog's state into the application..PPThere are also several other signals which may be useful:.TPcancelButtonPressed() is emitted when the user clicks Cancel..TPdefaultButtonPressed() is emitted when the user clicks Defaults; the slot it is connected to should reset the state of the dialog to the application defaults..TPhelpButtonPressed() is emitted when the user clicks Help..TPaboutToShow() is emitted at the start of show(); if there is any chance that the state of the application may change between the creation of the tab dialog and the time show() is called, you must connect this signal to a slot that resets the state of the dialog..TPcurrentChanged() is emitted when the user selects a page..PPEach tab is either enabled or disabled at any given time (see setTabEnabled()). If a tab is enabled the tab text is drawn in black and the user can select that tab. If it is disabled the tab is drawn in a different way and the user cannot select that tab. Note that even if a tab is disabled, the page can still be visible; for example, if all of the tabs happen to be disabled..PPYou can change a tab's label and iconset using changeTab(). A tab page can be removed with removePage() and shown with showPage(). The current page is given by currentPage()..PPQTabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than QTabDialog provides, consider creating a QDialog and using a QTabBar with QTabWidgets..PPMost of the functionality in QTabDialog is provided by a QTabWidget..PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also QDialog and Dialog Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QTabDialog::QTabDialog ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )"Constructs a QTabDialog with only an OK button. The \fIparent\fR, \fIname\fR, \fImodal\fR and widget flag, \fIf\fR, arguments are passed on to the QDialog constructor..SH "QTabDialog::~QTabDialog ()"Destroys the tab dialog..SH "void QTabDialog::aboutToShow ()\fC [signal]\fR"This signal is emitted by show() when it is time to set the state of the dialog's contents. The dialog should reflect the current state of the application when it appears; if there is any possibility that the state of the application may change between the time you call QTabDialog::QTabDialog() and QTabDialog::show(), you should set the dialog's state in a slot and connect this signal to it..PPThis applies mainly to QTabDialog objects that are kept around hidden, rather than being created, shown, and deleted afterwards..PPSee also applyButtonPressed(), show(), and cancelButtonPressed()..SH "void QTabDialog::addTab ( QWidget * child, const QString & label )"Adds another tab and page to the tab view..PPThe new page is \fIchild\fR; the tab's label is \fIlabel\fR. Note the difference between the widget name (which you supply to widget constructors and to setTabEnabled(), for example) and the tab label. The name is internal to the program and invariant, whereas the label is shown on-screen and may vary according to language and other factors..PPIf the tab's \fIlabel\fR 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..PPIf you call addTab() after show() the screen will flicker and the user may be confused..PPSee also insertTab()..SH "void QTabDialog::addTab ( QWidget * child, const QIconSet & iconset, const QString & label )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis version of the function shows the \fIiconset\fR as well as the \fIlabel\fR on the tab of \fIchild\fR..SH "void QTabDialog::addTab ( QWidget * child, QTab * tab )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis is a lower-level method for adding tabs, similar to the other addTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() function for a subclass of QTab..PPThe \fIchild\fR is the widget to be placed on the new tab page. The \fItab\fR is the tab to display on the tab page -- normally this shows a label or an icon that identifies the tab page.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -