qtabbar.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 322 行 · 第 1/2 页

HTML
322
字号
<!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/qtabbar.cpp:153 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QTabBar 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&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;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>QTabBar Class Reference</h1><p>The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs.<a href="#details">More...</a><p><tt>#include &lt;<a href="qtabbar-h.html">qtabbar.h</a>&gt;</tt><p>Inherits <a href="qwidget.html">QWidget</a>.<p><a href="qtabbar-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QTabBar"><b>QTabBar</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#~QTabBar"><b>~QTabBar</b></a> ()</div></li><li><div class=fn>enum <a href="#Shape-enum"><b>Shape</b></a> { RoundedAbove, RoundedBelow, TriangularAbove, TriangularBelow }</div></li><li><div class=fn>Shape <a href="#shape"><b>shape</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setShape"><b>setShape</b></a> ( Shape )</div></li><li><div class=fn>virtual int <a href="#addTab"><b>addTab</b></a> ( QTab&nbsp;*&nbsp;newTab )</div></li><li><div class=fn>virtual int <a href="#insertTab"><b>insertTab</b></a> ( QTab&nbsp;*&nbsp;newTab, int&nbsp;index = -1 )</div></li><li><div class=fn>virtual void <a href="#removeTab"><b>removeTab</b></a> ( QTab&nbsp;*&nbsp;t )</div></li><li><div class=fn>virtual void <a href="#setTabEnabled"><b>setTabEnabled</b></a> ( int&nbsp;id, bool&nbsp;enabled )</div></li><li><div class=fn>bool <a href="#isTabEnabled"><b>isTabEnabled</b></a> ( int&nbsp;id ) const</div></li><li><div class=fn>int <a href="#currentTab"><b>currentTab</b></a> () const</div></li><li><div class=fn>int <a href="#keyboardFocusTab"><b>keyboardFocusTab</b></a> () const</div></li><li><div class=fn>QTab * <a href="#tab"><b>tab</b></a> ( int&nbsp;id ) const</div></li><li><div class=fn>QTab * <a href="#tabAt"><b>tabAt</b></a> ( int&nbsp;index ) const</div></li><li><div class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( int&nbsp;id ) const</div></li><li><div class=fn>int <a href="#count"><b>count</b></a> () const</div></li><li><div class=fn>virtual void <a href="#layoutTabs"><b>layoutTabs</b></a> ()</div></li><li><div class=fn>virtual QTab * <a href="#selectTab"><b>selectTab</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) const</div></li><li><div class=fn>void <a href="#removeToolTip"><b>removeToolTip</b></a> ( int&nbsp;index )</div></li><li><div class=fn>void <a href="#setToolTip"><b>setToolTip</b></a> ( int&nbsp;index, const&nbsp;QString&nbsp;&amp;&nbsp;tip )</div></li><li><div class=fn>QString <a href="#toolTip"><b>toolTip</b></a> ( int&nbsp;index ) const</div></li></ul><h2>Public Slots</h2><ul><li><div class=fn>virtual void <a href="#setCurrentTab"><b>setCurrentTab</b></a> ( int )</div></li><li><div class=fn>virtual void <a href="#setCurrentTab-2"><b>setCurrentTab</b></a> ( QTab&nbsp;*&nbsp;tab )</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#selected"><b>selected</b></a> ( int&nbsp;id )</div></li></ul><h2>Properties</h2><ul><li><div class=fn>int <a href="#count-prop"><b>count</b></a>&nbsp;- the number of tabs in the tab bar &nbsp;<em>(read only)</em></div></li><li><div class=fn>int <a href="#currentTab-prop"><b>currentTab</b></a>&nbsp;- the id of the currently visible tab in the tab bar</div></li><li><div class=fn>int <a href="#keyboardFocusTab-prop"><b>keyboardFocusTab</b></a>&nbsp;- the id of the tab that currently has the keyboard focus &nbsp;<em>(read only)</em></div></li><li><div class=fn>Shape <a href="#shape-prop"><b>shape</b></a>&nbsp;- the shape of the tabs in the tab bar</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#paint"><b>paint</b></a> ( QPainter&nbsp;*&nbsp;p, QTab&nbsp;*&nbsp;t, bool&nbsp;selected ) const</div></li><li><div class=fn>virtual void <a href="#paintLabel"><b>paintLabel</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QRect&nbsp;&amp;&nbsp;br, QTab&nbsp;*&nbsp;t, bool&nbsp;has_focus ) const</div></li><li><div class=fn>virtual void <a href="#paintEvent"><b>paintEvent</b></a> ( QPaintEvent&nbsp;*&nbsp;e )</div></li><li><div class=fn>QPtrList&lt;QTab&gt; * <a href="#tabList"><b>tabList</b></a> ()</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs.<p> <p> QTabBar is straightforward to use; it draws the tabs using one ofthe predefined <a href="#Shape-enum">shapes</a>, and emits asignal when a tab is selected.  It can be subclassed to tailor thelook and feel.<p> The choice of tab shape is a matter of taste, although tab dialogs(preferences and the like) invariably use <a href="#Shape-enum">RoundedAbove</a>, andnobody uses <a href="#Shape-enum">TriangularAbove</a>.  Tab controls in windows other thandialogs almost always use either <a href="#Shape-enum">RoundedBelow</a> or <a href="#Shape-enum">TriangularBelow</a>.  Many spreadsheets and other tab controls in whichall the pages are essentially similar use <a href="#Shape-enum">TriangularBelow</a>,whereas <a href="#Shape-enum">RoundedBelow</a> is used mostly when the pages are different(e.g. a multi-page tool palette).<p> The most important part of QTabBar's API is the signal <a href="#selected">selected</a>().This is emitted whenever the selected page changes (even at startup,when the selected page changes from 'none').  There is also a slot,<a href="#setCurrentTab">setCurrentTab</a>(), which can be used to select a pageprogrammatically.<p> QTabBar creates automatic accelerator keys in the manner of <a href="qbutton.html">QButton</a>;e.g. if a tab's label is "&amp;Graphics", Alt+G becomes an acceleratorkey for switching to that tab.<p> The following virtual functions may need to be reimplemented:<ul><li> <a href="#paint">paint</a>() paints a single tab.  <a href="#paintEvent">paintEvent</a>() calls paint() foreach tab so that any overlap will look right.<li> <a href="#addTab">addTab</a>() creates a new tab and adds it to the bar.<li> <a href="#selectTab">selectTab</a>() decides which tab, if any, the user selects with the mouse.</ul><p> The index of the current tab is returned by <a href="#currentTab">currentTab</a>(). The tabwith a particular index is returned by <a href="#tabAt">tabAt</a>(), the tab with aparticular id is returned by <a href="#tab">tab</a>(). The index of a tab is returnedby <a href="#indexOf">indexOf</a>(). The current tab can be set by index or tab pointerusing one of the <a href="#setCurrentTab">setCurrentTab</a>() functions.<p> <img src=qtabbar-m.png> <img src=qtabbar-w.png><p>See also <a href="advanced.html">Advanced Widgets</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="Shape-enum"></a>QTabBar::Shape</h3> This enum type lists the built-in shapes supported by QTabBar:<ul><li><tt>QTabBar::RoundedAbove</tt> - the normal rounded look above the pages<li><tt>QTabBar::RoundedBelow</tt> - the normal rounded look below the pages<li><tt>QTabBar::TriangularAbove</tt> - triangular tabs above the pages (veryunusual; included for completeness)<li><tt>QTabBar::TriangularBelow</tt> - triangular tabs similar to those used inthe spreadsheet Excel, for example</ul><hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QTabBar"></a>QTabBar::QTabBar ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</h3>Constructs a new, empty tab bar; the <em>parent</em> and <em>name</em> argumentsare passed on to the <a href="qwidget.html">QWidget</a> constructor.<h3 class=fn><a name="~QTabBar"></a>QTabBar::~QTabBar ()</h3>Destroys the tab control, freeing memory used.<h3 class=fn>int <a name="addTab"></a>QTabBar::addTab ( <a href="qtab.html">QTab</a>&nbsp;*&nbsp;newTab )<tt> [virtual]</tt></h3>Adds the tab, <em>newTab</em>, to the tab control.<p> Sets <em>newTab</em>'s id to a new id and places the tab just to the right of theexisting tabs. If the tab's label contains an ampersand, the letterfollowing the ampersand is used as an accelerator for the tab, e.g.if the label is "Bro&wse" then Alt+W becomes an accelerator whichwill move the focus to this tab.Returns the id.<p> <p>See also <a href="#insertTab">insertTab</a>().<h3 class=fn>int <a name="count"></a>QTabBar::count () const</h3><p>Returns the number of tabs in the tab bar.See the <a href="qtabbar.html#count-prop">"count"</a> property for details.<h3 class=fn>int <a name="currentTab"></a>QTabBar::currentTab () const</h3><p>Returns the id of the currently visible tab in the tab bar.

⌨️ 快捷键说明

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