diff options
Diffstat (limited to 'doc/html/qtabbar.html')
-rw-r--r-- | doc/html/qtabbar.html | 345 |
1 files changed, 345 insertions, 0 deletions
diff --git a/doc/html/qtabbar.html b/doc/html/qtabbar.html new file mode 100644 index 000000000..174d3ecaa --- /dev/null +++ b/doc/html/qtabbar.html @@ -0,0 +1,345 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qtabbar.cpp:168 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQTabBar Class</title> +<style type="text/css"><!-- +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>TQTabBar Class Reference</h1> + +<p>The TQTabBar class provides a tab bar, e.g. for use in tabbed dialogs. +<a href="#details">More...</a> +<p><tt>#include <<a href="qtabbar-h.html">qtabbar.h</a>></tt> +<p>Inherits <a href="qwidget.html">TQWidget</a>. +<p><a href="qtabbar-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#TQTabBar"><b>TQTabBar</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li> +<li class=fn><a href="#~TQTabBar"><b>~TQTabBar</b></a> ()</li> +<li class=fn>enum <a href="#Shape-enum"><b>Shape</b></a> { RoundedAbove, RoundedBelow, TriangularAbove, TriangularBelow }</li> +<li class=fn>Shape <a href="#shape"><b>shape</b></a> () const</li> +<li class=fn>virtual void <a href="#setShape"><b>setShape</b></a> ( Shape )</li> +<li class=fn>virtual int <a href="#addTab"><b>addTab</b></a> ( TQTab * newTab )</li> +<li class=fn>virtual int <a href="#insertTab"><b>insertTab</b></a> ( TQTab * newTab, int index = -1 )</li> +<li class=fn>virtual void <a href="#removeTab"><b>removeTab</b></a> ( TQTab * t )</li> +<li class=fn>virtual void <a href="#setTabEnabled"><b>setTabEnabled</b></a> ( int id, bool enabled )</li> +<li class=fn>bool <a href="#isTabEnabled"><b>isTabEnabled</b></a> ( int id ) const</li> +<li class=fn>int <a href="#currentTab"><b>currentTab</b></a> () const</li> +<li class=fn>int <a href="#keyboardFocusTab"><b>keyboardFocusTab</b></a> () const</li> +<li class=fn>TQTab * <a href="#tab"><b>tab</b></a> ( int id ) const</li> +<li class=fn>TQTab * <a href="#tabAt"><b>tabAt</b></a> ( int index ) const</li> +<li class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( int id ) const</li> +<li class=fn>int <a href="#count"><b>count</b></a> () const</li> +<li class=fn>virtual void <a href="#layoutTabs"><b>layoutTabs</b></a> ()</li> +<li class=fn>virtual TQTab * <a href="#selectTab"><b>selectTab</b></a> ( const TQPoint & p ) const</li> +<li class=fn>void <a href="#removeToolTip"><b>removeToolTip</b></a> ( int index )</li> +<li class=fn>void <a href="#setToolTip"><b>setToolTip</b></a> ( int index, const TQString & tip )</li> +<li class=fn>TQString <a href="#toolTip"><b>toolTip</b></a> ( int index ) const</li> +</ul> +<h2>Public Slots</h2> +<ul> +<li class=fn>virtual void <a href="#setCurrentTab"><b>setCurrentTab</b></a> ( int )</li> +<li class=fn>virtual void <a href="#setCurrentTab-2"><b>setCurrentTab</b></a> ( TQTab * tab )</li> +</ul> +<h2>Signals</h2> +<ul> +<li class=fn>void <a href="#selected"><b>selected</b></a> ( int id )</li> +<li class=fn>void <a href="#layoutChanged"><b>layoutChanged</b></a> ()</li> +</ul> +<h2>Properties</h2> +<ul> +<li class=fn>int <a href="#count-prop"><b>count</b></a> - the number of tabs in the tab bar <em>(read only)</em></li> +<li class=fn>int <a href="#currentTab-prop"><b>currentTab</b></a> - the id of the tab bar's visible tab</li> +<li class=fn>int <a href="#keyboardFocusTab-prop"><b>keyboardFocusTab</b></a> - the id of the tab that has the keyboard focus <em>(read only)</em></li> +<li class=fn>Shape <a href="#shape-prop"><b>shape</b></a> - the shape of the tabs in the tab bar</li> +</ul> +<h2>Protected Members</h2> +<ul> +<li class=fn>virtual void <a href="#paint"><b>paint</b></a> ( TQPainter * p, TQTab * t, bool selected ) const</li> +<li class=fn>virtual void <a href="#paintLabel"><b>paintLabel</b></a> ( TQPainter * p, const TQRect & br, TQTab * t, bool has_focus ) const</li> +<li class=fn>virtual void <a href="#paintEvent"><b>paintEvent</b></a> ( TQPaintEvent * e )</li> +<li class=fn>TQPtrList<TQTab> * <a href="#tabList"><b>tabList</b></a> ()</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQTabBar class provides a tab bar, e.g. for use in tabbed dialogs. +<p> +<p> TQTabBar 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. TQt also provides a ready-made <a href="qtabwidget.html">TQTabWidget</a> and a +<a href="qtabdialog.html">TQTabDialog</a>. +<p> The choice of tab shape is a matter of taste, although tab dialogs +(for preferences and similar) invariably use <a href="#Shape-enum">RoundedAbove</a>; +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 TQTabBar's API is the <a href="#selected">selected</a>() signal. +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> TQTabBar creates automatic accelerator keys in the manner of +<a href="qbutton.html">TQButton</a>; e.g. if a tab's label is "&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>TQTabBar::Shape</h3> + +<p> This enum type lists the built-in shapes supported by TQTabBar: +<ul> +<li><tt>TQTabBar::RoundedAbove</tt> - the normal rounded look above the pages +<li><tt>TQTabBar::RoundedBelow</tt> - the normal rounded look below the pages +<li><tt>TQTabBar::TriangularAbove</tt> - triangular tabs above the pages (very +unusual; included for completeness) +<li><tt>TQTabBar::TriangularBelow</tt> - triangular tabs similar to those used in +the Excel spreadsheet, for example +</ul> +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="TQTabBar"></a>TQTabBar::TQTabBar ( <a href="qwidget.html">TQWidget</a> * parent = 0, const char * 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">TQWidget</a> constructor. + +<h3 class=fn><a name="~TQTabBar"></a>TQTabBar::~TQTabBar () +</h3> +Destroys the tab control, freeing memory used. + +<h3 class=fn>int <a name="addTab"></a>TQTabBar::addTab ( <a href="qtab.html">TQTab</a> * 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>TQTabBar::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>TQTabBar::currentTab () const +</h3><p>Returns the id of the tab bar's visible tab. +See the <a href="qtabbar.html#currentTab-prop">"currentTab"</a> property for details. +<h3 class=fn>int <a name="indexOf"></a>TQTabBar::indexOf ( int id ) const +</h3> +Returns the position index of the tab with id <em>id</em> or -1 if no +tab has this <em>id</em>. +<p> <p>See also <a href="#tabAt">tabAt</a>(). + +<h3 class=fn>int <a name="insertTab"></a>TQTabBar::insertTab ( <a href="qtab.html">TQTab</a> * newTab, int 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 appended. +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>TQTabBar::isTabEnabled ( int id ) const +</h3> +Returns TRUE if the tab with id <em>id</em> exists and is enabled; +otherwise returns FALSE. +<p> <p>See also <a href="#setTabEnabled">setTabEnabled</a>(). + +<h3 class=fn>int <a name="keyboardFocusTab"></a>TQTabBar::keyboardFocusTab () const +</h3><p>Returns the id of the tab that has the keyboard focus. +See the <a href="qtabbar.html#keyboardFocusTab-prop">"keyboardFocusTab"</a> property for details. +<h3 class=fn>void <a name="layoutChanged"></a>TQTabBar::layoutChanged ()<tt> [signal]</tt> +</h3> + +<p> TQTabBar emits the signal whenever the layout of the tab bar has +been recalculated, for example when the contents of a tab change. + +<h3 class=fn>void <a name="layoutTabs"></a>TQTabBar::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>TQTabBar::paint ( <a href="qpainter.html">TQPainter</a> * p, <a href="qtab.html">TQTab</a> * t, bool 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 +TQTabBar. 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>TQTabBar::paintEvent ( <a href="qpaintevent.html">TQPaintEvent</a> * 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">TQWidget</a>. +<h3 class=fn>void <a name="paintLabel"></a>TQTabBar::paintLabel ( <a href="qpainter.html">TQPainter</a> * p, const <a href="qrect.html">TQRect</a> & br, <a href="qtab.html">TQTab</a> * t, bool 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>TQTabBar::removeTab ( <a href="qtab.html">TQTab</a> * 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>TQTabBar::removeToolTip ( int index ) +</h3> +Removes the tool tip for the tab at index position <em>index</em>. + +<h3 class=fn><a href="qtab.html">TQTab</a> * <a name="selectTab"></a>TQTabBar::selectTab ( const <a href="qpoint.html">TQPoint</a> & 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>TQTabBar::selected ( int id )<tt> [signal]</tt> +</h3> + +<p> TQTabBar 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>TQTabBar::setCurrentTab ( int )<tt> [virtual slot]</tt> +</h3><p>Sets the id of the tab bar's visible tab. +See the <a href="qtabbar.html#currentTab-prop">"currentTab"</a> property for details. +<h3 class=fn>void <a name="setCurrentTab-2"></a>TQTabBar::setCurrentTab ( <a href="qtab.html">TQTab</a> * 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>TQTabBar::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>TQTabBar::setTabEnabled ( int id, bool 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>TQTabBar::setToolTip ( int index, const <a href="qstring.html">TQString</a> & tip ) +</h3> +Sets the tool tip for the tab at index position <em>index</em> to <em>tip</em>. + +<h3 class=fn><a href="qtabbar.html#Shape-enum">Shape</a> <a name="shape"></a>TQTabBar::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">TQTab</a> * <a name="tab"></a>TQTabBar::tab ( int id ) const +</h3> +Returns 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">TQTab</a> * <a name="tabAt"></a>TQTabBar::tabAt ( int index ) const +</h3> +Returns the tab at position <em>index</em>. +<p> <p>See also <a href="#indexOf">indexOf</a>(). + +<h3 class=fn><a href="qptrlist.html">TQPtrList</a><TQTab> * <a name="tabList"></a>TQTabBar::tabList ()<tt> [protected]</tt> +</h3> +The list of <a href="qtab.html">TQTab</a> objects in the tab bar. +<p> This list is unlikely to be in the order that the TQTab elements +appear visually. One way of iterating over the tabs is like this: +<pre> + for ( uint i = 0; i < myTabBar->count(); ++i ) { + nextTab = myTabBar->tabAt( i ); + // do something with nextTab + } + </pre> + + +<h3 class=fn><a href="qstring.html">TQString</a> <a name="toolTip"></a>TQTabBar::toolTip ( int index ) const +</h3> +Returns the tool tip for the tab at index position <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 tab bar's visible tab. +<p>If no tab page is currently visible, the property's value is -1. +Even if the property's 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 has the <a href="focus.html#keyboard-focus">keyboard focus</a>. +<p>This property contains the id of the tab that has the keyboard +focus or -1 if the tab bar does not have the keyboard focus. + +<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 is 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">TQt toolkit</a>. +Copyright © 1995-2007 +<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 © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>TQt 3.3.8</div> +</table></div></address></body> +</html> |