qtabwidget.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 408 行 · 第 1/2 页
HTML
408 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qtabwidget.cpp:49 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QTabWidget Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QTabWidget Class Reference</h1><p>The QTabWidget class provides a stack of tabbed widgets.<a href="#details">More...</a><p><tt>#include <<a href="qtabwidget-h.html">qtabwidget.h</a>></tt><p>Inherits <a href="qwidget.html">QWidget</a>.<p><a href="qtabwidget-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QTabWidget"><b>QTabWidget</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</div></li><li><div class=fn>virtual void <a href="#addTab"><b>addTab</b></a> ( QWidget * child, const QString & label )</div></li><li><div class=fn>virtual void <a href="#addTab-2"><b>addTab</b></a> ( QWidget * child, const QIconSet & iconset, const QString & label )</div></li><li><div class=fn>virtual void <a href="#addTab-3"><b>addTab</b></a> ( QWidget * child, QTab * tab )</div></li><li><div class=fn>virtual void <a href="#insertTab"><b>insertTab</b></a> ( QWidget * child, const QString & label, int index = -1 )</div></li><li><div class=fn>virtual void <a href="#insertTab-2"><b>insertTab</b></a> ( QWidget * child, const QIconSet & iconset, const QString & label, int index = -1 )</div></li><li><div class=fn>virtual void <a href="#insertTab-3"><b>insertTab</b></a> ( QWidget * child, QTab * tab, int index = -1 )</div></li><li><div class=fn>void <a href="#changeTab"><b>changeTab</b></a> ( QWidget * w, const QString & label )</div></li><li><div class=fn>void <a href="#changeTab-2"><b>changeTab</b></a> ( QWidget * w, const QIconSet & iconset, const QString & label )</div></li><li><div class=fn>bool <a href="#isTabEnabled"><b>isTabEnabled</b></a> ( QWidget * w ) const</div></li><li><div class=fn>void <a href="#setTabEnabled"><b>setTabEnabled</b></a> ( QWidget * w, bool enable )</div></li><li><div class=fn>QString <a href="#tabLabel"><b>tabLabel</b></a> ( QWidget * w ) const</div></li><li><div class=fn>void <a href="#setTabLabel"><b>setTabLabel</b></a> ( QWidget * w, const QString & l )</div></li><li><div class=fn>QIconSet <a href="#tabIconSet"><b>tabIconSet</b></a> ( QWidget * w ) const</div></li><li><div class=fn>void <a href="#setTabIconSet"><b>setTabIconSet</b></a> ( QWidget * w, const QIconSet & iconset )</div></li><li><div class=fn>void <a href="#removeTabToolTip"><b>removeTabToolTip</b></a> ( QWidget * w )</div></li><li><div class=fn>void <a href="#setTabToolTip"><b>setTabToolTip</b></a> ( QWidget * w, const QString & tip )</div></li><li><div class=fn>QString <a href="#tabToolTip"><b>tabToolTip</b></a> ( QWidget * w ) const</div></li><li><div class=fn>QWidget * <a href="#currentPage"><b>currentPage</b></a> () const</div></li><li><div class=fn>QWidget * <a href="#page"><b>page</b></a> ( int index ) const</div></li><li><div class=fn>QString <a href="#label"><b>label</b></a> ( int index ) const</div></li><li><div class=fn>int <a href="#currentPageIndex"><b>currentPageIndex</b></a> () const</div></li><li><div class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( QWidget * w ) const</div></li><li><div class=fn>enum <a href="#TabPosition-enum"><b>TabPosition</b></a> { Top, Bottom }</div></li><li><div class=fn>TabPosition <a href="#tabPosition"><b>tabPosition</b></a> () const</div></li><li><div class=fn>void <a href="#setTabPosition"><b>setTabPosition</b></a> ( TabPosition )</div></li><li><div class=fn>enum <a href="#TabShape-enum"><b>TabShape</b></a> { Rounded, Triangular }</div></li><li><div class=fn>TabShape <a href="#tabShape"><b>tabShape</b></a> () const</div></li><li><div class=fn>void <a href="#setTabShape"><b>setTabShape</b></a> ( TabShape s )</div></li><li><div class=fn>int <a href="#margin"><b>margin</b></a> () const</div></li><li><div class=fn>void <a href="#setMargin"><b>setMargin</b></a> ( int )</div></li><li><div class=fn>int <a href="#count"><b>count</b></a> () const</div></li></ul><h2>Public Slots</h2><ul><li><div class=fn>void <a href="#setCurrentPage"><b>setCurrentPage</b></a> ( int )</div></li><li><div class=fn>virtual void <a href="#showPage"><b>showPage</b></a> ( QWidget * w )</div></li><li><div class=fn>virtual void <a href="#removePage"><b>removePage</b></a> ( QWidget * w )</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QWidget * )</div></li></ul><h2>Properties</h2><ul><li><div class=fn>bool <a href="#autoMask-prop"><b>autoMask</b></a> - whether the tab widget is automatically masked <em>(read only)</em></div></li><li><div class=fn>int <a href="#count-prop"><b>count</b></a> - the number of tabs in the tab bar <em>(read only)</em></div></li><li><div class=fn>int <a href="#currentPage-prop"><b>currentPage</b></a> - the index position of the current tab page</div></li><li><div class=fn>int <a href="#margin-prop"><b>margin</b></a> - the margin in this tab widget</div></li><li><div class=fn>TabPosition <a href="#tabPosition-prop"><b>tabPosition</b></a> - the position of the tabs in this tab widget</div></li><li><div class=fn>TabShape <a href="#tabShape-prop"><b>tabShape</b></a> - the shape of the tabs in this tab widget</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>void <a href="#setTabBar"><b>setTabBar</b></a> ( QTabBar * tb )</div></li><li><div class=fn>QTabBar * <a href="#tabBar"><b>tabBar</b></a> () const</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QTabWidget class provides a stack of tabbed widgets.<p> <p> A tabbed widget is a widget that has a tab bar of tabs, and for eachtab a "page" which is a widget. The user selects which page to seeand use by clicking on its tab or by pressing the indicatedAlt+<em>letter</em> key combination.<p> QTabWidget provides a single row of tabs along the top or bottom ofthe pages (see <a href="#TabPosition-enum">TabPosition</a>).<p> The normal way to use QTabWidget is to do the following in theconstructor:<ol type=1><li> Create a QTabWidget.<li> Create a <a href="qwidget.html">QWidget</a> for each of the pages in the tab dialog, insertchildren into it, set up geometry management for it and use <a href="#addTab">addTab</a>()(or <a href="#insertTab">insertTab</a>()) to set up a tab and keyboard accelerator for it.<li> Connect to the signals and slots.</ol><p> The position of the tabs is set with <a href="#setTabPosition">setTabPosition</a>(), theirshape with <a href="#setTabShape">setTabShape</a>(), and their margin with <a href="#setMargin">setMargin</a>().<p> If you don't call addTab() the page you have created will not bevisible. Don't confuse the object name you supply to theQWidget constructor and the tab label you supply to addTab().addTab() takes a name which indicates an accelerator and ismeaningful and descriptive to the user, whereas the widget name isused primarily for debugging.<p> The signal <a href="#currentChanged">currentChanged</a>() is emitted when the user selects a page.<p> The current page is available as an index position with<a href="#currentPageIndex">currentPageIndex</a>() or as a wiget pointer with <a href="#currentPage">currentPage</a>(). You canretrieve a pointer to a page with a given index using <a href="#page">page</a>(), andcan find the index position of a page with <a href="#indexOf">indexOf</a>(). Use<a href="#setCurrentPage">setCurrentPage</a>() to show a particular page by index, or <a href="#showPage">showPage</a>()to show a page by widget pointer.<p> You can change a tab's label and iconset using <a href="#changeTab">changeTab</a>() or<a href="#setTabLabel">setTabLabel</a>() and <a href="#setTabIconSet">setTabIconSet</a>(). A tab page can be removed with<a href="#removePage">removePage</a>().<p> Each tab is either enabled or disabled at any given time (see<a href="#setTabEnabled">setTabEnabled</a>()). If a tab is enabled, the tab text is drawn inblack and the user can select that tab. If it is disabled, the tabis 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.<p> Although tab widgets can be a very good way to split up a complexdialog, it's also very easy to get into a mess. See <a href="qtabdialog.html">QTabDialog</a> forsome design hints.<p> Most of the functionality in QTabWidget is provided by a <a href="qtabbar.html">QTabBar</a> (atthe top, providing the tabs) and a <a href="qwidgetstack.html">QWidgetStack</a> (most of the area,organizing the individual pages).<p> <img src=qtabwidget-m.png> <img src=qtabwidget-w.png><p> <p>See also <a href="qtabdialog.html">QTabDialog</a>, <a href="advanced.html">Advanced Widgets</a> and <a href="organizers.html">Organizers</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="TabPosition-enum"></a>QTabWidget::TabPosition</h3> <p> This enum type defines where QTabWidget can draw the tab row:<ul><li><tt>QTabWidget::Top</tt> - above the pages<li><tt>QTabWidget::Bottom</tt> - below the pages</ul><h3 class=fn><a name="TabShape-enum"></a>QTabWidget::TabShape</h3> <p> This enum type defines the shape of the tabs:<ul><li><tt>QTabWidget::Rounded</tt> - rounded look (normal)<li><tt>QTabWidget::Triangular</tt> - triangular look (very unusual, included for completeness)</ul><hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QTabWidget"></a>QTabWidget::QTabWidget ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )</h3>Constructs a tabbed widget with parent <em>parent</em>, name <em>name</em>,and widget flags <em>f</em>.<h3 class=fn>void <a name="addTab"></a>QTabWidget::addTab ( <a href="qwidget.html">QWidget</a> * child, const <a href="qstring.html">QString</a> & label )<tt> [virtual]</tt></h3>Adds another tab and page to the tab view.<p> The new page is <em>child</em>; the tab's label is <em>label</em>.Note the difference between the widget name (which you supply towidget constructors and to <a href="#setTabEnabled">setTabEnabled</a>(), for example) and the tablabel. The name is internal to the program and invariant, whereasthe label is shown on-screen and may vary according to language andother factors.<p> If the tab's <em>label</em> contains an ampersand, the letter followingthe ampersand is used as an accelerator for the tab, e.g. if thelabel is "Bro&wse" then Alt+W becomes an accelerator which willmove the focus to this tab.<p> If you call <a href="#addTab">addTab</a>() after <a href="qwidget.html#show">show</a>() the screen will flicker and theuser may be confused.<p> <p>See also <a href="#insertTab">insertTab</a>().<p>Examples: <a href="addressbook-example.html#x549">addressbook/centralwidget.cpp</a> and <a href="themes-example.html#x303">themes/themes.cpp</a>.<h3 class=fn>void <a name="addTab-2"></a>QTabWidget::addTab ( <a href="qwidget.html">QWidget</a> * child, const <a href="qiconset.html">QIconSet</a> & iconset, const <a href="qstring.html">QString</a> & label )<tt> [virtual]</tt></h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> Adds another tab and page to the tab view.<p> This function is the same as <a href="#addTab">addTab</a>(), but with an additional<em>iconset</em>.<h3 class=fn>void <a name="addTab-3"></a>QTabWidget::addTab ( <a href="qwidget.html">QWidget</a> * child, <a href="qtab.html">QTab</a> * tab )<tt> [virtual]</tt></h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> This is a low-level function for adding tabs. It is useful if youare using <a href="#setTabBar">setTabBar</a>() to set a <a href="qtabbar.html">QTabBar</a> subclass with an overridden<a href="qtabbar.html#paint">QTabBar::paint</a>() routine for a subclass of <a href="qtab.html">QTab</a>. The <em>child</em> isthe new page and <em>tab</em> is the tab to put the <em>child</em> on.<h3 class=fn>void <a name="changeTab"></a>QTabWidget::changeTab ( <a href="qwidget.html">QWidget</a> * w, const <a href="qstring.html">QString</a> & label )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?