📄 qtabwidget.3qt
字号:
'\" t.TH QTabWidget 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 NAMEQTabWidget \- Stack of tabbed widgets.SH SYNOPSIS\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, WFlags f = 0 )".br.ti -1c.BI "virtual void \fBaddTab\fR ( QWidget * child, const QString & label )".br.ti -1c.BI "virtual void \fBaddTab\fR ( QWidget * child, const QIconSet & iconset, const QString & label )".br.ti -1c.BI "virtual void \fBaddTab\fR ( QWidget * child, QTab * tab )".br.ti -1c.BI "virtual void \fBinsertTab\fR ( QWidget * child, const QString & label, int index = -1 )".br.ti -1c.BI "virtual void \fBinsertTab\fR ( QWidget * child, const QIconSet & iconset, const QString & label, int index = -1 )".br.ti -1c.BI "virtual 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 "QString \fBtabLabel\fR ( QWidget * w ) const".br.ti -1c.BI "void \fBsetTabLabel\fR ( QWidget * w, const QString & l )".br.ti -1c.BI "QIconSet \fBtabIconSet\fR ( QWidget * w ) const".br.ti -1c.BI "void \fBsetTabIconSet\fR ( QWidget * w, const QIconSet & iconset )".br.ti -1c.BI "void \fBremoveTabToolTip\fR ( QWidget * w )".br.ti -1c.BI "void \fBsetTabToolTip\fR ( QWidget * w, const QString & tip )".br.ti -1c.BI "QString \fBtabToolTip\fR ( QWidget * w ) const".br.ti -1c.BI "QWidget * \fBcurrentPage\fR () const".br.ti -1c.BI "QWidget * \fBpage\fR ( int index ) const".br.ti -1c.BI "QString \fBlabel\fR ( int index ) const".br.ti -1c.BI "int \fBcurrentPageIndex\fR () const".br.ti -1c.BI "int \fBindexOf\fR ( QWidget * w ) 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.ti -1c.BI "int \fBcount\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "void \fBsetCurrentPage\fR ( int )".br.ti -1c.BI "virtual void \fBshowPage\fR ( QWidget * w )".br.ti -1c.BI "virtual void \fBremovePage\fR ( QWidget * w )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBcurrentChanged\fR ( QWidget * )".br.in -1c.SS "Properties".in +1c.ti -1c.BI "bool \fBautoMask\fR - whether the tab widget is automatically masked \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBcount\fR - the number of tabs in the tab bar \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBcurrentPage\fR - the index position of the current tab page".br.ti -1c.BI "int \fBmargin\fR - the margin in this tab widget".br.ti -1c.BI "TabPosition \fBtabPosition\fR - the position of the tabs in this tab widget".br.ti -1c.BI "TabShape \fBtabShape\fR - the shape of the tabs in this tab widget".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 QTabWidget class provides a stack of tabbed widgets..PPA tabbed widget is a widget that has a tab bar of tabs, and for each tab a "page" which is a widget. The user selects which page to see and use by clicking on its tab or by pressing the indicated Alt+\fIletter\fR key combination..PPQTabWidget provides a single row of tabs along the top or bottom of the pages (see TabPosition)..PPThe normal way to use QTabWidget is to do the following in the constructor: <ol type=1>.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() (or insertTab()) to set up a tab and keyboard accelerator for it..IP 3Connect to the signals and slots..PPThe position of the tabs is set with setTabPosition(), their shape with setTabShape(), and their margin with setMargin()..PPIf you don't call addTab() and the QTabWidget is already visible, then 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 a name which indicates an accelerator and is meaningful and descriptive to the user, whereas the widget name is used primarily for debugging..PPThe signal currentChanged() is emitted when the user selects a page..PPThe current page is available as an index position with currentPageIndex() or as a wiget pointer with currentPage(). You can retrieve a pointer to a page with a given index using page(), and can find the index position of a page with indexOf(). Use setCurrentPage() to show a particular page by index, or showPage() to show a page by widget pointer..PPYou can change a tab's label and iconset using changeTab() or setTabLabel() and setTabIconSet(). A tab page can be removed with removePage()..PPEach tab is either enabled or disabled at any given time (see setTabEnabled()). If a tab is enabled, the tab text is drawn normally 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..PPAlthough tab widgets can be a very good way to split up a complex dialog, it's also very easy to get into a mess. See QTabDialog for some design hints. An alternative is to use a QWidgetStack for which you provide some means of navigating between pages, for example, a QToolBar or a QListBox..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, Advanced Widgets, and Organizers..SS "Member Type Documentation".SH "QTabWidget::TabPosition"This enum type defines where QTabWidget draws the tab row:.TP\fCQTabWidget::Top\fR - above the pages
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -