⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtabbar.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QTabBar 3qt "11 October 2001" "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, e.g. for use in tabbed dialogs.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 * newTab )".br.ti -1c.BI "virtual int \fBinsertTab\fR ( QTab * newTab, int index = -1 )".br.ti -1c.BI "virtual void \fBremoveTab\fR ( QTab * t )".br.ti -1c.BI "virtual void \fBsetTabEnabled\fR ( int id, bool enabled )".br.ti -1c.BI "bool \fBisTabEnabled\fR ( int id ) 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 id ) const".br.ti -1c.BI "QTab * \fBtabAt\fR ( int index ) const".br.ti -1c.BI "int \fBindexOf\fR ( int id ) const".br.ti -1c.BI "int \fBcount\fR () const".br.ti -1c.BI "virtual void \fBlayoutTabs\fR ()".br.ti -1c.BI "virtual QTab * \fBselectTab\fR ( const QPoint & p ) const".br.ti -1c.BI "void \fBremoveToolTip\fR ( int index )".br.ti -1c.BI "void \fBsetToolTip\fR ( int index, const QString & tip )".br.ti -1c.BI "QString \fBtoolTip\fR ( int index ) const".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 * tab )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBselected\fR ( int id )".br.in -1c.SS "Properties".in +1c.ti -1c.BI "int \fBcount\fR - the number of tabs in the tab bar  \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBcurrentTab\fR - the id of the currently visible tab in the tab bar".br.ti -1c.BI "int \fBkeyboardFocusTab\fR - the id of the tab that currently has the keyboard focus  \fI(read " "only" ")\fR".br.ti -1c.BI "Shape \fBshape\fR - the shape of the tabs in the tab bar".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBpaint\fR ( QPainter * p, QTab * t, bool selected ) const".br.ti -1c.BI "virtual void \fBpaintLabel\fR ( QPainter * p, const QRect & br, QTab * t, bool has_focus ) const".br.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * e )".br.ti -1c.BI "QPtrList<QTab> * \fBtabList\fR ()".br.in -1c.SH DESCRIPTIONThe QTabBar class provides a tab bar, e.g. for use in tabbed dialogs..PPQTabBar is straightforward to use; it draws the tabs using one of the predefined shapes, and emits a signal when a tab is selected. It can be subclassed to tailor the look and feel..PPThe choice of tab shape is a matter of taste, although tab dialogs (preferences and the like) invariably use RoundedAbove, and nobody uses TriangularAbove. Tab controls in windows other than dialogs almost always use either RoundedBelow or TriangularBelow. Many spreadsheets and other tab controls in which all the pages are essentially similar use TriangularBelow, whereas RoundedBelow is used mostly when the pages are different (e.g. a multi-page tool palette)..PPThe most important part of QTabBar's API is the signal selected(). This is emitted whenever the selected page changes (even at startup, when the selected page changes from 'none'). There is 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 so that any overlap will look right..TPaddTab() creates a new tab and adds it to the bar..TPselectTab() decides which tab, if any, the user selects with the mouse..PPThe index of the current tab is returned by currentTab(). The tab with a particular index is returned by tabAt(), the tab with a particular id is returned by tab(). The index of a tab is returned by indexOf(). The current tab can be set by index or tab pointer using one of the setCurrentTab() functions..PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also Advanced Widgets..SS "Member Type Documentation".SH "QTabBar::Shape"This enum type lists the built-in shapes supported by QTabBar:.TP\fCQTabBar::RoundedAbove\fR - the normal rounded look above the pages.TP\fCQTabBar::RoundedBelow\fR - the normal rounded look below the pages.TP\fCQTabBar::TriangularAbove\fR - triangular tabs above the pages (very unusual; included for completeness).TP\fCQTabBar::TriangularBelow\fR - triangular tabs similar to those used in the spreadsheet Excel, for example.SH MEMBER FUNCTION DOCUMENTATION.SH "QTabBar::QTabBar ( QWidget * parent = 0, const char * name = 0 )"Constructs a new, empty tab bar; the \fIparent\fR and \fIname\fR arguments are passed on to the QWidget constructor..SH "QTabBar::~QTabBar ()"Destroys the tab control, freeing memory used..SH "int QTabBar::addTab ( QTab * newTab )\fC [virtual]\fR"Adds the tab, \fInewTab\fR, to the tab control..PPSets \fInewTab\fR's id to a new id and places the tab just to the right of the existing tabs. If the tab's label 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. Returns the id..PPSee also insertTab()..SH "int QTabBar::count () const"Returns the number of tabs in the tab bar. See the "count" property for details..SH "int QTabBar::currentTab () const"Returns the id of the currently visible tab in the tab bar. See the "currentTab" property for details..SH "int QTabBar::indexOf ( int id ) const"Returns the position index of the tab with id \fIid\fR..PPSee also tabAt()..SH "int QTabBar::insertTab ( QTab * newTab, int index = -1 )\fC [virtual]\fR"Inserts the tab, \fInewTab\fR, into the tab control..PPIf \fIindex\fR is not specified, the tab is simply added. Otherwise it's inserted at the specified position..PPSets \fInewTab\fR's id to a new id. If the tab's label 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. Returns the id..PPSee also addTab()..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 "int QTabBar::keyboardFocusTab () const"Returns the id of the tab that currently has the keyboard focus. See the "keyboardFocusTab" property for details..SH "void QTabBar::layoutTabs ()\fC [virtual]\fR"Lays out all existing tabs according to their label and their iconset..SH "void QTabBar::paint ( QPainter * p, QTab * t, bool selected ) const\fC [virtual protected]\fR"Paints the tab \fIt\fR using painter \fIp\fR. If and only if \fIselected\fR is TRUE, \fIt\fR is drawn 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. The event is passed in \fIe\fR..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. A focus indication is drawn if \fIhas_focus\fR is TRUE..SH "void QTabBar::removeTab ( QTab * t )\fC [virtual]\fR"Removes tab \fIt\fR from the tab control, and deletes the tab..SH "void QTabBar::removeToolTip ( int index )"Removes the tool tip for the tab at index \fIindex\fR..SH "QTab * QTabBar::selectTab ( const QPoint & p ) const\fC [virtual]\fR"This virtual function 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. Otherwise it returns 0..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 by the user. The argument \fIid\fR is the id of the tab as returned by addTab()..PPshow() is guaranteed to emit this signal; you can display your page in a slot connected to this signal..SH "void QTabBar::setCurrentTab ( int )\fC [virtual slot]\fR"Sets the id of the currently visible tab in the tab bar. See the "currentTab" property for details..SH "void QTabBar::setCurrentTab ( QTab * tab )\fC [virtual slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPRaises \fItab\fR and emits the selected() signal unless the tab was already current..PPSee also currentTab and selected()..SH "void QTabBar::setShape ( Shape )\fC [virtual]\fR"Sets the shape of the tabs in the tab bar. See the "shape" property for details..SH "void QTabBar::setTabEnabled ( int id, bool enabled )\fC [virtual]\fR"Enables tab \fIid\fR if \fIenabled\fR is TRUE or disables it if \fIenabled\fR is FALSE. If \fIid\fR is currently selected, setTabEnabled(FALSE) makes another tab selected..PPsetTabEnabled() updates the display if this causes a change in \fIid\fR's status..PPSee also update() and isTabEnabled()..SH "void QTabBar::setToolTip ( int index, const QString & tip )"Sets the tool tip for the tab at index \fIindex\fR to \fItip\fR..SH "Shape QTabBar::shape () const"Returns the shape of the tabs in the tab bar. See the "shape" property for details..SH "QTab * QTabBar::tab ( int id ) const"Returns a pointer to the tab with id \fIid\fR or 0 if there is no such tab..PPSee also count..SH "QTab * QTabBar::tabAt ( int index ) const"Returns a pointer to the tab at the position \fIindex\fR..PPSee also indexOf()..SH "QPtrList<QTab> * QTabBar::tabList ()\fC [protected]\fR"The list of QTab objects in the tab bar..SH "QString QTabBar::toolTip ( int index ) const"Returns the tool tip for the tab at index \fIindex\fR..SS "Property Documentation".SH "int count"This property holds the number of tabs in the tab bar..PPGet this property's value with count()..PPSee also tab()..SH "int currentTab"This property holds the id of the currently visible tab in the tab bar..PPIf no tab page is currently visible, -1 will be the current value for this property. Even if the property value is not -1, you cannot assume that the user can see the relevant page, or that the tab is enabled. When you need to display something the value of this property represents the best page to display..PPWhen this property is set to \fIid\fR, it will raise the tab with the id \fIid\fR and emit the selected() signal..PPSee also selected() and isTabEnabled()..PPSet this property's value with setCurrentTab() and get this property's value with currentTab()..SH "int keyboardFocusTab"This property holds the id of the tab that currently has the keyboard focus..PPThis property contains the id of the tab that currently has the keyboard focus. If the tab bar does not have keyboard focus, the value of this property will be -1..PPGet this property's value with keyboardFocusTab()..SH "Shape shape"This property holds the shape of the tabs in the tab bar..PPThe value of this property can be one of the following: RoundedAbove (default), RoundedBelow, TriangularAbove or TriangularBelow..PPSee also Shape..PPSet this property's value with setShape() and get this property's value with shape()..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 help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtabbar.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -