📄 qtabwidget.3qt
字号:
'\" t.TH QTabWidget 3qt "24 January 2005" "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 NAMEQTabWidget \- Stack of tabbed widgets.br.PP\fC#include <qtabwidget.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQTabWidget\fR ( QWidget * " "parent" ", const char * " "name" ", WFlags f ) ".br.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 "int \fBcurrentPageIndex\fR () const".br.ti -1c.BI "void \fBsetCurrentPage\fR ( int ) ".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 "enum \fBTabShape\fR { Rounded, Triangular }".br.ti -1c.BI "TabShape \fBtabShape\fR () const".br.ti -1c.BI "void \fBsetTabShape\fR ( TabShape s ) ".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 \fBcurrentChanged\fR ( QWidget * ) ".br.ti -1c.BI "void \fBselected\fR ( const QString & ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetTabBar\fR ( QTabBar * ) ".br.ti -1c.BI "QTabBar* \fBtabBar\fR () const".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE OptionsTabPosition tabPosition tabPosition setTabPositionTabShape tabShape tabShape setTabShapeint margin margin setMarginint currentPage currentPageIndex setCurrentPage.TE.fi.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..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 currentChanged() 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.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also QTabDialog..SS "Member Type Documentation".SH "QTabWidget::TabPosition"This enum type defines where QTabWidget can draw the tab row: .TP\fCTop\fR - above the pages.TP\fCBottom\fR - below the pages.SH "QTabWidget::TabShape"This enum type defines the shape of the tabs: .TP\fCRounded\fR - rounded look (normal).TP\fCTriangular\fR - triangular look (very unusual, included for completeness).SH MEMBER FUNCTION DOCUMENTATION.SH "QTabWidget::QTabWidget ( QWidget * parent, const char * name, WFlags f )"Constructs a tabbed widget with parent \fIparent,\fR name \fIname\fR and widget flags \fIf.\fR.SH "QTabWidget::QTabWidget ( QWidget * parent=0, const char * name=0 )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..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 QIconSet & iconset, const QString & label )"Defines a new \fIiconset\fR and a new \fIlabel\fR for the tab of page \fIw\fR.SH "void QTabWidget::changeTab ( QWidget * w, const QString & label )"Defines a new label for the tab of page \fIw\fR.SH "void QTabWidget::currentChanged ( QWidget * ) \fC[signal]\fR"This signal is emitted whenever the current page changes..PPSee also currentPage(), showPage() and tabLabel()..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 "int QTabWidget::currentPageIndex () const"Returns the ID of the current page..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() and QWidgetStack::removeWidget()..SH "void QTabWidget::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabWidget::setCurrentPage ( int id )"Sets the page with index \fIid\fR as current page..PPNote that \fIid\fR is not the index that is specified when you insert a tab..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::setTabPosition ( TabPosition pos )"Sets the position of the tabs to \fIpos\fR.PPPossible values are QTabWidget::Top and QTabWidget::Bottom..PPSee also tabPosition()..SH "void QTabWidget::setTabShape ( TabShape s )"Sets the shape of the tabs to \fIs.\fR.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"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSizePolicy QTabWidget::sizePolicy () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..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 "QTabWidget::TabPosition QTabWidget::tabPosition() const"Returns the position of the tabs..PPPossible values are QTabWidget::Top and QTabWidget::Bottom..PPSee also setTabPosition()..SH "QTabWidget::TabShape QTabWidget::tabShape() const"Returns the shape of the tabs..PPSee also setTabShape()..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://doc.trolltech.com/qtabwidget.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtabwidget.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -