Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1894

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/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 of
the predefined <a href="#Shape-enum">shapes</a>, and emits a
signal when a tab is selected.  It can be subclassed to tailor the
look 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>, and
nobody uses <a href="#Shape-enum">TriangularAbove</a>.  Tab controls in windows other than
dialogs almost always use either <a href="#Shape-enum">RoundedBelow</a> or <a href="#Shape-enum">TriangularBelow</a>.  Many spreadsheets and other tab controls in which
all 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 page
programmatically.
<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 accelerator
key 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() for
each 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 tab
with a particular index is returned by <a href="#tabAt">tabAt</a>(), the tab with a
particular id is returned by <a href="#tab">tab</a>(). The index of a tab is returned
by <a href="#indexOf">indexOf</a>(). The current tab can be set by index or tab pointer
using 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 (very
unusual; included for completeness)
<li><tt>QTabBar::TriangularBelow</tt> - triangular tabs similar to those used in
the 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> arguments
are 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 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.
<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.
See the <a href="qtabbar.html#currentTab-prop">"currentTab"</a> property for details.
<h3 class=fn>int <a name="indexOf"></a>QTabBar::indexOf ( int&nbsp;id ) const
</h3>
Returns the position index of the tab with id <em>id</em>.
<p> <p>See also <a href="#tabAt">tabAt</a>().

<h3 class=fn>int <a name="insertTab"></a>QTabBar::insertTab ( <a href="qtab.html">QTab</a>&nbsp;*&nbsp;newTab, int&nbsp;index = -1 )<tt> [virtual]</tt>
</h3>
Inserts the tab, <em>newTab</em>, into the tab control.
<p> If <em>index</em> is not specified, the tab is simply added. Otherwise
it's inserted at the specified position.
<p> Sets <em>newTab</em>'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.
<p> <p>See also <a href="#addTab">addTab</a>().

<h3 class=fn>bool <a name="isTabEnabled"></a>QTabBar::isTabEnabled ( int&nbsp;id ) const
</h3>
Returns TRUE if the tab with id <em>id</em> is enabled, or FALSE if it
is disabled or there is no such tab.
<p> <p>See also <a href="#setTabEnabled">setTabEnabled</a>().

<h3 class=fn>int <a name="keyboardFocusTab"></a>QTabBar::keyboardFocusTab () const
</h3><p>Returns the id of the tab that currently has the keyboard focus.
See the <a href="qtabbar.html#keyboardFocusTab-prop">"keyboardFocusTab"</a> property for details.
<h3 class=fn>void <a name="layoutTabs"></a>QTabBar::layoutTabs ()<tt> [virtual]</tt>
</h3>
Lays out all existing tabs according to their label and their
iconset.

<h3 class=fn>void <a name="paint"></a>QTabBar::paint ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, <a href="qtab.html">QTab</a>&nbsp;*&nbsp;t, bool&nbsp;selected ) const<tt> [virtual protected]</tt>
</h3>  Paints the tab <em>t</em> using painter <em>p</em>.  If and only if <em>selected</em>
is TRUE, <em>t</em> is drawn currently selected.
<p> This virtual function may be reimplemented to change the look of
QTabBar.  If you decide to reimplement it, you may also need to
reimplement <a href="qwidget.html#sizeHint">sizeHint</a>().

<h3 class=fn>void <a name="paintEvent"></a>QTabBar::paintEvent ( <a href="qpaintevent.html">QPaintEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
</h3>
Repaints the tab row.  All the painting is done by <a href="#paint">paint</a>();
<a href="#paintEvent">paintEvent</a>() only decides which tabs need painting and in what
order. The event is passed in <em>e</em>.
<p> <p>See also <a href="#paint">paint</a>().

<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget</a>.
<h3 class=fn>void <a name="paintLabel"></a>QTabBar::paintLabel ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;br, <a href="qtab.html">QTab</a>&nbsp;*&nbsp;t, bool&nbsp;has_focus ) const<tt> [virtual protected]</tt>
</h3>
Paints the label of tab <em>t</em> centered in rectangle <em>br</em> using
painter <em>p</em>. A focus indication is drawn if <em>has_focus</em> is TRUE.

<h3 class=fn>void <a name="removeTab"></a>QTabBar::removeTab ( <a href="qtab.html">QTab</a>&nbsp;*&nbsp;t )<tt> [virtual]</tt>
</h3>
Removes tab <em>t</em> from the tab control, and deletes the tab.

<h3 class=fn>void <a name="removeToolTip"></a>QTabBar::removeToolTip ( int&nbsp;index )
</h3> Removes the tool tip for the tab at index <em>index</em>.

<h3 class=fn><a href="qtab.html">QTab</a>&nbsp;* <a name="selectTab"></a>QTabBar::selectTab ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const<tt> [virtual]</tt>
</h3>
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 <em>p</em>, if
exactly one tab's bounding rectangle contains <em>p</em>.  Otherwise it returns 0.
<p> <p>See also <a href="qwidget.html#mousePressEvent">mousePressEvent</a>() and <a href="qwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>().

<h3 class=fn>void <a name="selected"></a>QTabBar::selected ( int&nbsp;id )<tt> [signal]</tt>
</h3>

<p> QTabBar emits this signal whenever any tab is selected, whether by
the program or by the user.  The argument <em>id</em> is the id of the tab
as returned by <a href="#addTab">addTab</a>().
<p> <a href="qwidget.html#show">show</a>() is guaranteed to emit this signal; you can display
your page in a slot connected to this signal.

<h3 class=fn>void <a name="setCurrentTab"></a>QTabBar::setCurrentTab ( int )<tt> [virtual slot]</tt>
</h3><p>Sets the id of the currently visible tab in the tab bar.
See the <a href="qtabbar.html#currentTab-prop">"currentTab"</a> property for details.
<h3 class=fn>void <a name="setCurrentTab-2"></a>QTabBar::setCurrentTab ( <a href="qtab.html">QTab</a>&nbsp;*&nbsp;tab )<tt> [virtual slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Raises <em>tab</em> and emits the <a href="#selected">selected</a>() signal unless the tab was
already current.
<p> <p>See also <a href="#currentTab-prop">currentTab</a> and <a href="#selected">selected</a>().

<h3 class=fn>void <a name="setShape"></a>QTabBar::setShape ( <a href="qtabbar.html#Shape-enum">Shape</a> )<tt> [virtual]</tt>
</h3><p>Sets the shape of the tabs in the tab bar.
See the <a href="qtabbar.html#shape-prop">"shape"</a> property for details.
<h3 class=fn>void <a name="setTabEnabled"></a>QTabBar::setTabEnabled ( int&nbsp;id, bool&nbsp;enabled )<tt> [virtual]</tt>
</h3>
Enables tab <em>id</em> if <em>enabled</em> is TRUE or disables it if <em>enabled</em> is
FALSE.  If <em>id</em> is currently selected, <a href="#setTabEnabled">setTabEnabled</a>(FALSE) makes
another tab selected.
<p> setTabEnabled() updates the display if this causes a
change in <em>id</em>'s status.
<p> <p>See also <a href="qwidget.html#update">update</a>() and <a href="#isTabEnabled">isTabEnabled</a>().

<h3 class=fn>void <a name="setToolTip"></a>QTabBar::setToolTip ( int&nbsp;index, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tip )
</h3> Sets the tool tip for the tab at index <em>index</em> to <em>tip</em>.

<h3 class=fn><a href="qtabbar.html#Shape-enum">Shape</a> <a name="shape"></a>QTabBar::shape () const
</h3><p>Returns the shape of the tabs in the tab bar.
See the <a href="qtabbar.html#shape-prop">"shape"</a> property for details.
<h3 class=fn><a href="qtab.html">QTab</a>&nbsp;* <a name="tab"></a>QTabBar::tab ( int&nbsp;id ) const
</h3>  Returns a pointer to the tab with id <em>id</em> or 0 if there is no
such tab.
<p> <p>See also <a href="#count-prop">count</a>.

<h3 class=fn><a href="qtab.html">QTab</a>&nbsp;* <a name="tabAt"></a>QTabBar::tabAt ( int&nbsp;index ) const
</h3> Returns a pointer to the tab at the position <em>index</em>.
<p> <p>See also <a href="#indexOf">indexOf</a>().

<h3 class=fn><a href="qptrlist.html">QPtrList</a>&lt;QTab&gt;&nbsp;* <a name="tabList"></a>QTabBar::tabList ()<tt> [protected]</tt>
</h3>
The list of <a href="qtab.html">QTab</a> objects in the tab bar.

<h3 class=fn><a href="qstring.html">QString</a> <a name="toolTip"></a>QTabBar::toolTip ( int&nbsp;index ) const
</h3> Returns the tool tip for the tab at index <em>index</em>.

<hr><h2>Property Documentation</h2>
<h3 class=fn>int <a name="count-prop"></a>count</h3> <p>This property holds the number of tabs in the tab bar.
<p>Get this property's value with <a href="#count">count</a>().
<p><p>See also <a href="#tab">tab</a>().

<h3 class=fn>int <a name="currentTab-prop"></a>currentTab</h3> <p>This property holds the id of the currently visible tab in the tab bar.
<p>If 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.
<p> When this property is set to <em>id</em>, it will raise the tab with the
id <em>id</em> and emit the <a href="#selected">selected</a>() signal.
<p> <p>See also <a href="#selected">selected</a>() and <a href="#isTabEnabled">isTabEnabled</a>().

<p>Set this property's value with <a href="#setCurrentTab">setCurrentTab</a>() and get this property's value with <a href="#currentTab">currentTab</a>().
<h3 class=fn>int <a name="keyboardFocusTab-prop"></a>keyboardFocusTab</h3> <p>This property holds the id of the tab that currently has the keyboard focus.
<p>This 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.
<p> 
<p>Get this property's value with <a href="#keyboardFocusTab">keyboardFocusTab</a>().
<h3 class=fn><a href="qtabbar.html#Shape-enum">Shape</a> <a name="shape-prop"></a>shape</h3> <p>This property holds the shape of the tabs in the tab bar.
<p>The value of this property can be one of the following:
<a href="#Shape-enum">RoundedAbove</a> (default), <a href="#Shape-enum">RoundedBelow</a>, <a href="#Shape-enum">TriangularAbove</a> or <a href="#Shape-enum">TriangularBelow</a>.
<p> <p>See also <a href="#Shape-enum">Shape</a>.

<p>Set this property's value with <a href="#setShape">setShape</a>() and get this property's value with <a href="#shape">shape</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>