📄 qtabwidget.3qt
字号:
.TH QTabWidget 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQTabWidget \- Stack of tabbed widgets.SH SYNOPSIS.br.PP\fC#include <qtabwidget.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQTabWidget\fR ( QWidget * " "parent" "=0, const char * " "name" "=0 )".br.ti -1c.BI "\fB~QTabWidget\fR ()".br.ti -1c.BI "void \fBaddTab\fR ( QWidget *, const QString & )".br.ti -1c.BI "void \fBaddTab\fR ( QWidget * " "child" ", const QIconSet & " "iconset" ", const QString & label )".br.ti -1c.BI "void \fBaddTab\fR ( QWidget *, QTab * )".br.ti -1c.BI "void \fBinsertTab\fR ( QWidget *, const QString &, 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 *, QTab *, int " "index" " = -1 )".br.ti -1c.BI "void \fBchangeTab\fR ( QWidget *, const QString & )".br.ti -1c.BI "void \fBchangeTab\fR ( QWidget * " "child" ", const QIconSet & " "iconset" ", const QString & label )".br.ti -1c.BI "bool \fBisTabEnabled\fR ( QWidget * ) const".br.ti -1c.BI "void \fBsetTabEnabled\fR ( QWidget *, bool )".br.ti -1c.BI "void \fBshowPage\fR ( QWidget * )".br.ti -1c.BI "void \fBremovePage\fR ( QWidget * )".br.ti -1c.BI "QString \fBtabLabel\fR ( QWidget * )".br.ti -1c.BI "QWidget* \fBcurrentPage\fR () const".br.ti -1c.BI "virtual QSize \fBsizeHint\fR () const".br.ti -1c.BI "virtual QSize \fBminimumSizeHint\fR () const".br.ti -1c.BI "enum \fBTabPosition\fR { Top, Bottom }".br.ti -1c.BI "TabPosition \fBtabPosition\fR () const".br.ti -1c.BI "void \fBsetTabPosition\fR ( TabPosition )".br.ti -1c.BI "int \fBmargin\fR () const".br.ti -1c.BI "void \fBsetMargin\fR ( int )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBselected\fR ( const QString & )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBshowEvent\fR ( QShowEvent * )".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * )".br.ti -1c.BI "void \fBsetTabBar\fR ( QTabBar * )".br.ti -1c.BI "QTabBar* \fBtabBar\fR () const".br.ti -1c.BI "virtual void \fBstyleChange\fR ( QStyle & )".br.ti -1c.BI "virtual void \fBupdateMask\fR ()".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject *, QEvent * )".br.in -1c.SH DESCRIPTIONThe QTabWidget class provides a stack of tabbed widgets..PPA tabbed widget is one in which several "pages" are available, and the user selects which page to see and use by clicking on its tab, or by pressing the indicated Alt-(letter) key combination..PPQTabWidget does not provide more than one row of tabs, and does not provide tabs along the sides or bottom of the pages. It also does not offer any way to find out which page is currently visible or to set the visible page..PPThe normal way to use QTabWidget is to do the following in the constructor: .IP 1Create a QTabWidget. .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() to set up a tab and keyboard accelerator for it. .IP 3Connect to the signals and slots. .PPIf you don't call addTab(), the page you have created will not be visible. Please don't confuse the object name you supply to the QWidget constructor and the tab label you supply to addTab(): addTab() takes a name which indicates an accelerator and is meaningful and descriptive to the user, while the widget name is used primarily for debugging..PPA signal selected() is emitted when the user selects some page..PPEach tab is either enabled or disabled at any given time. 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 can not select that tab. Note that even though a tab is disabled, the page can still be visible, for example if all of the tabs happen to be disabled..PPWhile tab widgets can be a very good way to split up a complex dialog, it's also very easy to make a royal mess out of it. See QTabDialog for some design hints..PPMost of the functionality in QTabWidget is provided by a QTabBar (at the top, providing the tabs) and a QWidgetStack (most of the area, organizing the individual pages)..PP<img src=qtabwidget-m.png> <img src=qtabwidget-w.png>.PPSee also: QTabDialog..SH MEMBER FUNCTION DOCUMENTATION.SH "QTabWidget::QTabWidget ( QWidget * parent=0, const char * name=0 )"Constructs a QTabWidget..SH "QTabWidget::~QTabWidget ()"Destructs the tab widget..SH "void QTabWidget::addTab ( QWidget * child, QTab * tab )"This 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() routine for a subclass of QTab..SH "void QTabWidget::addTab ( QWidget * child, const QIconSet & iconset, const QString & label )"Adds another tab and page to the tab view..PPThis function is the same as addTab() but with an additional iconset..SH "void QTabWidget::addTab ( QWidget * child, const QString & label )"Adds another tab and page to the tab view..PPThe tab will be labelled \fIlabel\fR and \fIchild\fR constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to e.g. setTabEnabled()) and the tab label: The name is internal to the program and invariant, while the label is shown on screen and may vary according to e.g. language..PP\fIlabel\fR is written in the QButton style, where &P makes Qt create an accelerator key on Alt-P for this page. For example:.PP.nf.br td->addTab( graphicsPane, "&Graphics" );.br td->addTab( soundPane, "&Sound" );.fi.PPIf the user presses Alt-S the sound page of the tab dialog is shown, if the user presses Alt-P the graphics page is shown..PPIf you call addTab() after show(), the screen will flicker and the user will be confused..SH "void QTabWidget::changeTab ( QWidget * w, const QString & label )"Defines a new label for the tab of page \\w..SH "QWidget * QTabWidget::currentPage () const"Returns a pointer to the page currently being displayed by the tab dialog. The tab dialog does its best to make sure that this value is never 0, but if you try hard enough it can be..SH "bool QTabWidget::eventFilter ( QObject * o, QEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "void QTabWidget::insertTab ( QWidget * child, QTab * tab, int index = -1 )"This is a lower-level method for inserting tabs, similar to the other insertTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() routine for a subclass of QTab..SH "void QTabWidget::insertTab ( QWidget * child, const QIconSet & iconset, const QString & label, int index = -1 )"Inserts another tab and page to the tab view..PPThis function is the same as insertTab() but with an additional iconset..SH "void QTabWidget::insertTab ( QWidget * child, const QString & label, int index = -1 )"Inserts another tab and page to the tab view..PPThe tab will be labelled \fIlabel\fR and \fIchild\fR constitutes the new page. Note the difference between the widget name (which you supply to widget constructors and to e.g. setTabEnabled()) and the tab label: The name is internal to the program and invariant, while the label is shown on screen and may vary according to e.g. language..PP\fIlabel\fR is written in the QButton style, where &P makes Qt create an accelerator key on Alt-P for this page. For example:.PP.nf.br td->insertTab( graphicsPane, "&Graphics" );.br td->insertTab( soundPane, "&Sound" );.fi.PPIf \fIindex\fR is not specified, the tab is simply added. Otherwise it's inserted at the specified position..PPIf the user presses Alt-S the sound page of the tab dialog is shown, if the user presses Alt-P the graphics page is shown..PPIf you call insertTab() after show(), the screen will flicker and the user will be confused..SH "bool QTabWidget::isTabEnabled ( QWidget * w ) const"Returns TRUE if the page \fIw\fR is enabled, and false if it is disabled..PPSee also: setTabEnabled() and QWidget::isEnabled()..SH "int QTabWidget::margin () const"Returns the width of the margin. The margin is the distance between the innermost pixel of the frame and the outermost pixel of the pages..PPSee also: setMargin()..SH "QSize QTabWidget::minimumSizeHint () const \fC[virtual]\fR"Returns a suitable minimum size for the tab widget..PPReimplemented from QWidget..SH "void QTabWidget::removePage ( QWidget * w )"Removes page \fIw\fR from this stack of widgets. Does not delete \fIw.\fR.PPSee also: showPage(), \\sa and QWidgetStack::removeWidget()..SH "void QTabWidget::selected ( const QString & tabLabel ) \fC[signal]\fR"This signal is emitted whenever a tab is selected (raised), including during the first show()..PPSee also: raise()..SH "void QTabWidget::setMargin ( int w )"Sets the width of the margin to \fIw.\fR.PPSee also: margin()..SH "void QTabWidget::setTabBar ( QTabBar * tb ) \fC[protected]\fR"Replaces the QTabBar heading the dialog by the given tab bar. Note that this must be called \fIbefore\fR any tabs have been added, or the behavior is undefined..PPSee also: tabBar()..SH "void QTabWidget::setTabEnabled ( QWidget * w, bool enable )"Enables/disables page \fIw\fR according to the value of \fIenable,\fR and redraws the page's tab appropriately..PPQTabWidget uses QWidget::setEnabled() internally, rather than keep a separate flag..PPNote that even a disabled tab/page may be visible. If the page is visible already, QTabWidget will not hide it, and if all the pages are disabled, QTabWidget will show one of them..PPSee also: isTabEnabled() and QWidget::setEnabled()..SH "void QTabWidget::showEvent ( QShowEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabWidget::showPage ( QWidget * w )"Ensures that \fIw\fR is shown. This is useful mainly for accelerators..PP\fBWarning:\fR Used carelessly, this function can easily surprise or confuse the user..PPSee also: QTabBar::setCurrentTab()..SH "QSize QTabWidget::sizeHint () const \fC[virtual]\fR"Returns a suitable size for the tab widget..PPReimplemented from QWidget..SH "void QTabWidget::styleChange ( QStyle & old ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QTabBar* QTabWidget::tabBar () const \fC[protected]\fR"Returns the currently set QTabBar..PPSee also: setTabBar()..SH "QString QTabWidget::tabLabel ( QWidget * w )"Returns the text in the tab for page \fIw.\fR.SH "void QTabWidget::updateMask () \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "SEE ALSO".BR http://www.troll.no/qt/qtabwidget.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -