📄 qtabbar.3qt
字号:
'\" t.TH QTabBar 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 NAMEQTabBar \- Tab bar, for use in e.g. tabbed dialogs.br.PP\fC#include <qtabbar.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQTabBar\fR ( QWidget * " "parent" " = 0, const char * " "name" " = 0 ) ".br.ti -1c.BI "\fB~QTabBar\fR () ".br.ti -1c.BI "enum \fBShape\fR { RoundedAbove, RoundedBelow, TriangularAbove, TriangularBelow }".br.ti -1c.BI "Shape \fBshape\fR () const".br.ti -1c.BI "virtual void \fBsetShape\fR ( Shape ) ".br.ti -1c.BI "virtual int \fBaddTab\fR ( QTab * ) ".br.ti -1c.BI "virtual int \fBinsertTab\fR ( QTab *, int " "index" " = -1 ) ".br.ti -1c.BI "virtual void \fBremoveTab\fR ( QTab * ) ".br.ti -1c.BI "virtual void \fBsetTabEnabled\fR ( int, bool ) ".br.ti -1c.BI "bool \fBisTabEnabled\fR ( int ) const".br.ti -1c.BI "int \fBcurrentTab\fR () const".br.ti -1c.BI "int \fBkeyboardFocusTab\fR () const".br.ti -1c.BI "QTab* \fBtab\fR ( int ) ".br.ti -1c.BI "int \fBcount\fR () const".br.ti -1c.BI "virtual void \fBlayoutTabs\fR () ".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetCurrentTab\fR ( int ) ".br.ti -1c.BI "virtual void \fBsetCurrentTab\fR ( QTab * ) ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBselected\fR ( int ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBpaint\fR ( QPainter *, QTab *, bool ) const".br.ti -1c.BI "virtual void \fBpaintLabel\fR ( QPainter *, const QRect &, QTab *, bool ) const".br.ti -1c.BI "virtual QTab* \fBselectTab\fR ( const QPoint & p ) const".br.ti -1c.BI "virtual void \fBupdateMask\fR () ".br.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * ) ".br.ti -1c.BI "QList<QTab>* \fBtabList\fR () ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE OptionsShape shape shape setShapeint currentTab currentTab setCurrentTabint count countint keyboardFocusTab keyboardFocusTab.TE.fi.SH DESCRIPTIONThe QTabBar class provides a tab bar, for use in e.g. tabbed dialogs..PPThe class is quite simple; it draws the tabs in one of four shapes and emits a signal when one is selected. It can be subclassed to tailor the look and feel..PPQTabBar itself support four possible shapes, described in the QTabBar::Shape documentation..PPThe choice of tab shape is still a matter of taste, to a large degree. Tab dialogs (preferences and the like) invariably use \fCRoundedAbove\fR and nobody uses \fCTriangularAbove.\fR Tab controls in windows other than dialogs almost always either \fCRoundedBelow\fR or \fCTriangularBelow.\fR Many spreadsheets and other tab controls where all the pages are essentially similar to use \fCTriangularBelow,\fR while \fCRoundedBelow\fR is used mostly when the pages are different (e.g. a multi-page tool palette). There is no strong tradition yet, however, so use your taste and create the tradition..PPThe most important part of QTabBar's API is the signal selected(). It's emitted whenever the selected page changes (even at startup, when the selected page changes from 'none'). There are also a slot, setCurrentTab(), which can be used to select a page programmatically..PPQTabBar creates automatic accelerator keys in the manner of QButton; e.g. if a tab's label is "&Graphics" Alt-G becomes an accelerator key for switching to that tab..PPThe following virtual functions may need to be reimplemented: .TPpaint() paints a single tab. paintEvent() calls paint() for each tab in such a way that any overlap will look right. .TPaddTab() creates a new tab and adds it to the bar. .TPselectTab() decides which, if any, tab the user selects with the mouse. .PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PP.SS "Member Type Documentation".SH "QTabBar::Shape"This enum type lists the built-in shapes supported by QTabBar:.TP\fCRoundedAbove\fR - the normal rounded look, above the pages.TP\fCRoundedBelow\fR - the normal rounded look, below the pages.TP\fCTriangularAbove\fR - triangular tabs, above the pages (very unusual, included for completeness).TP\fCTriangularBelow\fR - triangular tabs, similar to those used in e.g. the spreadsheet Excel.IP.SH MEMBER FUNCTION DOCUMENTATION.SH "QTabBar::QTabBar ( QWidget * parent = 0, const char * name = 0 )"Constructs a new, empty tab bar..SH "QTabBar::~QTabBar ()"Destroys the tab control, freeing memory used..SH "int QTabBar::addTab ( QTab * newTab ) \fC[virtual]\fR"Adds \fInewTab\fR to the tab control..PPAllocates a new id, sets \fInewTab's\fR id, locates it just to the right of the existing tabs, inserts an accelerator if the tab's label contains the string "&p" for some value of p, adds it to the bar, and returns the newly allocated id..SH "int QTabBar::count () const"Returns the number of tabs in the tab bar..PPSee also tab()..SH "int QTabBar::currentTab () const"If a page is currently visible, returns its ID. If no page is currently visible, returns either -1 or the ID of one of the pages..PPEven if the return value is not -1, you cannot assume either that the user can see the relevant page, or that the tab is enabled..PPWhen you need to display something, the return value from this function represents the best page to display. That's all..PPSee also selected()..SH "void QTabBar::focusInEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabBar::focusOutEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QTabBar::insertTab ( QTab * newTab, int index = -1 ) \fC[virtual]\fR"Inserts \fInewTab\fR to the tab control..PPIf \fIindex\fR is not specified, the tab is simply added. Otherwise it's inserted at the specified position..PPAllocates a new id, sets \fInewTab's\fR id, locates it respectively, inserts an accelerator if the tab's label contains the string "&p" for some value of p, adds it to the bar, and returns the newly allocated id..SH "bool QTabBar::isTabEnabled ( int id ) const"Returns TRUE if the tab with id \fIid\fR is enabled, or FALSE if it is disabled or there is no such tab..PPSee also setTabEnabled()..SH "void QTabBar::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QTabBar::keyboardFocusTab () const"If this tab control has keyboard focus, returns the ID of the tab Space will select. Otherwise, returns -1..SH "void QTabBar::layoutTabs () \fC[virtual]\fR"Layout all existing tabs (i.e. setting their \fCr\fR attribute) according to their label and their iconset..SH "QSize QTabBar::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabBar::mousePressEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabBar::mouseReleaseEvent ( QMouseEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabBar::paint ( QPainter * p, QTab * t, bool selected ) const \fC[virtual protected]\fR"Paint the single tab \fIt\fR using \fIp.\fR If and only if \fIselected\fR is TRUE, \fIt\fR is currently selected..PPThis virtual function may be reimplemented to change the look of QTabBar. If you decide to reimplement it, you may also need to reimplement sizeHint()..SH "void QTabBar::paintEvent ( QPaintEvent * e ) \fC[virtual protected]\fR"Repaints the tab row. All the painting is done by paint(); paintEvent() only decides which tabs need painting and in what order..PPSee also paint()..PPReimplemented from QWidget..SH "void QTabBar::paintLabel ( QPainter * p, const QRect & br, QTab * t, bool has_focus ) const \fC[virtual protected]\fR"Paints the label of tab \fIt\fR centered in rectangle \fIbr\fR using painter \fIp\fR and draws a focus indication if \fIhas_focus\fR is TRUE..SH "void QTabBar::removeTab ( QTab * t ) \fC[virtual]\fR"Removes tab \fIt\fR from the tab control..SH "void QTabBar::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QTab * QTabBar::selectTab ( const QPoint & p ) const \fC[virtual protected]\fR"This virtual functions is called by the mouse event handlers to determine which tab is pressed. The default implementation returns a pointer to the tab whose bounding rectangle contains \fIp,\fR if exactly one tab's bounding rectangle contains \fIp.\fR It returns 0 else..PPSee also mousePressEvent() and mouseReleaseEvent()..SH "void QTabBar::selected ( int id ) \fC[signal]\fR"QTabBar emits this signal whenever any tab is selected, whether by the program or the user. The argument \fIid\fR is the ID if the tab as returned by addTab()..PPshow() is guaranteed to emit this signal, so that you can display your page in a slot connected to this signal..SH "void QTabBar::setCurrentTab ( QTab * tab ) \fC[virtual slot]\fR"Raises \fItab\fR and emits the selected() signal unless the tab was already current..PPSee also currentTab() and selected()..SH "void QTabBar::setCurrentTab ( int id ) \fC[virtual slot]\fR"Raises the tab with ID \fIid\fR and emits the selected() signal..PPSee also currentTab(), selected() and tab()..SH "void QTabBar::setShape ( Shape s )"Sets the shape of this tab bar to \fIs\fR and refreshes the bar..SH "void QTabBar::setTabEnabled ( int id, bool enabled ) \fC[virtual]\fR"Enable tab \fIid\fR if \fIenable\fR is TRUE, or disable it if \fIenable\fR is FALSE. If \fIid\fR is currently selected, setTabEnabled() makes another tab selected..PPsetTabEnabled() updates the display respectively if this causes a change in \fIid's\fR status..PPSee also update() and isTabEnabled()..SH "QTabBar::Shape QTabBar::shape() const"Returns the shape of this tab bar..PPSee also setShape()..SH "void QTabBar::show () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSize QTabBar::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSizePolicy QTabBar::sizePolicy () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTabBar::styleChange ( QStyle & old ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QTab * QTabBar::tab ( int id )"Returns a pointer to the tab with ID \fIid,\fR or 0 if there is no such tab..PPSee also count()..SH "QList<QTab> * QTabBar::tabList () \fC[protected]\fR"The list of QTab objects added..SH "void QTabBar::updateMask () \fC[virtual protected]\fR"Draws the mask for this tab bar..PPReimplemented from QWidget..SH "SEE ALSO".BR http://doc.trolltech.com/qtabbar.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 (qtabbar.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -