1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - 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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QTabWidget Class Reference</h1><br clear="all">
<p>
The QTabWidget class provides a stack of tabbed widgets.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qtabwidget-h.html">qtabwidget.h</a>></code>
<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="#bf6179"><b>QTabWidget</b></a>(QWidget*parent, constchar*name, WFlagsf)</div>
<li><div class="fn"><a href="#5ab5ef"><b>QTabWidget</b></a>(QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn"><a href="#aff17d"><b>~QTabWidget</b></a>()</div>
<li><div class="fn">void<a href="#231c02"><b>addTab</b></a>(QWidget*, constQString&)</div>
<li><div class="fn">void<a href="#8fe081"><b>addTab</b></a>(QWidget*child, constQIconSet&iconset, constQString&label)</div>
<li><div class="fn">void<a href="#d2ea83"><b>addTab</b></a>(QWidget*, QTab*)</div>
<li><div class="fn">void<a href="#c6c175"><b>insertTab</b></a>(QWidget*, constQString&, intindex=-1)</div>
<li><div class="fn">void<a href="#d469d7"><b>insertTab</b></a>(QWidget*child, constQIconSet&iconset, constQString&label, intindex=-1)</div>
<li><div class="fn">void<a href="#ab9fc5"><b>insertTab</b></a>(QWidget*, QTab*, intindex=-1)</div>
<li><div class="fn">void<a href="#0e13dc"><b>changeTab</b></a>(QWidget*, constQString&)</div>
<li><div class="fn">void<a href="#fb4538"><b>changeTab</b></a>(QWidget*child, constQIconSet&iconset, constQString&label)</div>
<li><div class="fn">bool<a href="#973923"><b>isTabEnabled</b></a>(QWidget*)const</div>
<li><div class="fn">void<a href="#240827"><b>setTabEnabled</b></a>(QWidget*, bool)</div>
<li><div class="fn">void<a href="#ac313c"><b>showPage</b></a>(QWidget*)</div>
<li><div class="fn">void<a href="#e6bb7c"><b>removePage</b></a>(QWidget*)</div>
<li><div class="fn">QString<a href="#9b781c"><b>tabLabel</b></a>(QWidget*)</div>
<li><div class="fn">QWidget*<a href="#1895cb"><b>currentPage</b></a>()const</div>
<li><div class="fn">int<a href="#7dcf02"><b>currentPageIndex</b></a>()const</div>
<li><div class="fn">void<a href="#6d3c6f"><b>setCurrentPage</b></a>(int)</div>
<li><div class="fn">virtualQSize<a href="#808987"><b>minimumSizeHint</b></a>()const</div>
<li><div class="fn">enum<a href="#TabPosition"><b>TabPosition</b></a>{Top, Bottom}</div>
<li><div class="fn">TabPosition<a href="#c224c8"><b>tabPosition</b></a>()const</div>
<li><div class="fn">void<a href="#18b576"><b>setTabPosition</b></a>(TabPosition)</div>
<li><div class="fn">enum<a href="#TabShape"><b>TabShape</b></a>{Rounded, Triangular}</div>
<li><div class="fn">TabShape<a href="#2aba03"><b>tabShape</b></a>()const</div>
<li><div class="fn">void<a href="#38f5e4"><b>setTabShape</b></a>(TabShapes)</div>
<li><div class="fn">int<a href="#644993"><b>margin</b></a>()const</div>
<li><div class="fn">void<a href="#13adfc"><b>setMargin</b></a>(int)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#68220e"><b>currentChanged</b></a>(QWidget*)</div>
<li><div class="fn">void<b>selected</b>(constQString&)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<a href="#cd3661"><b>setTabBar</b></a>(QTabBar*)</div>
<li><div class="fn">QTabBar*<a href="#2dda19"><b>tabBar</b></a>()const</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>TabPosition<td>tabPosition<td>tabPosition<td>setTabPosition<td>
<tr><td>TabShape<td>tabShape<td>tabShape<td>setTabShape<td>
<tr><td>int<td>margin<td>margin<td>setMargin<td>
<tr><td>int<td>currentPage<td>currentPageIndex<td>setCurrentPage<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QTabWidget class provides a stack of tabbed widgets.
<p>
A tabbed widget is one in which several "pages" are available, and
the user selects which page to see and use by clicking on its tab,
or by pressing the indicated Alt-(letter) key combination.
<p>QTabWidget does not provide more than one row of tabs, and does not
provide tabs along the sides or bottom of the pages.
<p>The normal way to use QTabWidget is to do the following in the
constructor: <ol> <li> Create a QTabWidget. <li> Create a <a href="qwidget.html">QWidget</a>
for each of the pages in the tab dialog, insert children into it,
set up geometry management for it, and use <a href="#231c02">addTab</a>() to set up a tab
and keyboard accelerator for it. <li> Connect to the
signals and slots. </ol>
<p>If you don't call addTab(), the page you have created will not be
visible. Please don't confuse the object name you supply to the
QWidget constructor and the tab label you supply to addTab():
addTab() takes a name which indicates an accelerator and is
meaningful and descriptive to the user, while the widget name is
used primarily for debugging.
<p>A signal <a href="#68220e">currentChanged</a>() is emitted when the user selects some
page.
<p>Each tab is either enabled or disabled at any given time. If a tab
is enabled, the tab text is drawn in black and the user can select
that tab. If it is disabled, the tab is drawn in a different way
and the user can not select that tab. Note that even though a tab
is disabled, the page can still be visible, for example if all of
the tabs happen to be disabled.
<p>While tab widgets can be a very good way to split up a complex
dialog, it's also very easy to make a royal mess out of it. See
<a href="qtabdialog.html">QTabDialog</a> for some design hints.
<p>Most of the functionality in QTabWidget is provided by a <a href="qtabbar.html">QTabBar</a> (at
the 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>See also <a href="qtabdialog.html">QTabDialog</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="TabPosition">QTabWidget::TabPosition</a></h3>
This enum type defines where QTabWidget can draw the tab row: <ul>
<li> <code>Top</code> - above the pages
<li> <code>Bottom</code> - below the pages
</ul>
<h3 class="fn"><a name="TabShape">QTabWidget::TabShape</a></h3>
This enum type defines the shape of the tabs: <ul>
<li> <code>Rounded</code> - rounded look (normal)
<li> <code>Triangular</code> - triangular look (very unusual, included for completeness)
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="bf6179"></a>QTabWidget::QTabWidget(<a href="qwidget.html">QWidget</a>*parent, constchar*name, WFlagsf)</h3>
<p>Constructs a tabbed widget with parent <em>parent,</em> name <em>name</em>
and widget flags <em>f.</em>
<h3 class="fn"><a name="5ab5ef"></a>QTabWidget::QTabWidget(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn"><a name="aff17d"></a>QTabWidget::~QTabWidget()</h3>
<p>Destructs the tab widget.
<h3 class="fn">void<a name="d2ea83"></a>QTabWidget::addTab(<a href="qwidget.html">QWidget</a>*child, <a href="qtab.html">QTab</a>*tab)</h3>
<p>This is a lower-level method for adding tabs, similar to the other
<a href="#231c02">addTab</a>() method. It is useful if you are using <a href="#cd3661">setTabBar</a>() to set a
<a href="qtabbar.html">QTabBar</a> subclass with an overridden <a href="qtabbar.html#cc2aeb">QTabBar::paint</a>() routine for a
subclass of <a href="qtab.html">QTab</a>.
<h3 class="fn">void<a name="8fe081"></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)</h3>
<p>Adds another tab and page to the tab view.
<p>This function is the same as <a href="#231c02">addTab</a>() but with an additional
iconset.
<h3 class="fn">void<a name="231c02"></a>QTabWidget::addTab(<a href="qwidget.html">QWidget</a>*child, const<a href="qstring.html">QString</a>&label)</h3>
<p>Adds another tab and page to the tab view.
<p>The tab will be labelled <em>label</em> and <em>child</em> constitutes the new
page. Note the difference between the widget name (which you supply
to widget constructors and to e.g. <a href="#240827">setTabEnabled</a>()) and the tab
label: The name is internal to the program and invariant, while the
label is shown on screen and may vary according to e.g. language.
<p><em>label</em> is written in the <a href="qbutton.html">QButton</a> style, where &P makes Qt create
an accelerator key on Alt-P for this page. For example:
<p><pre> td->addTab( graphicsPane, "&Graphics" );
td->addTab( soundPane, "&Sound" );
</pre>
<p>If the user presses Alt-S the sound page of the tab dialog is shown,
if the user presses Alt-P the graphics page is shown.
<p>If you call addTab() after <a href="qwidget.html#200ee5">show</a>(), the screen will flicker and the
user will be confused.
<h3 class="fn">void<a name="fb4538"></a>QTabWidget::changeTab(<a href="qwidget.html">QWidget</a>*w, const<a href="qiconset.html">QIconSet</a>&iconset, const<a href="qstring.html">QString</a>&label)</h3>
<p>Defines a new <em>iconset</em> and a new <em>label</em> for the tab of page <em>w</em>
<h3 class="fn">void<a name="0e13dc"></a>QTabWidget::changeTab(<a href="qwidget.html">QWidget</a>*w, const<a href="qstring.html">QString</a>&label)</h3>
<p>Defines a new label for the tab of page <em>w</em>
<h3 class="fn">void<a name="68220e"></a>QTabWidget::currentChanged(<a href="qwidget.html">QWidget</a>*) <code>[signal]</code></h3>
<p>This signal is emitted whenever the current page changes.
<p>See also <a href="#1895cb">currentPage</a>(), <a href="#ac313c">showPage</a>() and <a href="#9b781c">tabLabel</a>().
<h3 class="fn"><a href="qwidget.html">QWidget</a>*<a name="1895cb"></a>QTabWidget::currentPage()const</h3>
<p>Returns a pointer to the page currently being displayed by the
tab dialog. The tab dialog does its best to make sure that this value
is never 0, but if you try hard enough it can be.
<h3 class="fn">int<a name="7dcf02"></a>QTabWidget::currentPageIndex()const</h3>
<p>Returns the ID of the current page.
<h3 class="fn">bool<a name="f9d699"></a>QTabWidget::eventFilter(<a href="qobject.html">QObject</a>*o, <a href="qevent.html">QEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qobject.html#bd20fe">QObject.</a>
<h3 class="fn">void<a name="ab9fc5"></a>QTabWidget::insertTab(<a href="qwidget.html">QWidget</a>*child, <a href="qtab.html">QTab</a>*tab, intindex=-1)</h3>
<p>This is a lower-level method for inserting tabs, similar to the other
insertTab() method. It is useful if you are using <a href="#cd3661">setTabBar</a>() to set a
<a href="qtabbar.html">QTabBar</a> subclass with an overridden <a href="qtabbar.html#cc2aeb">QTabBar::paint</a>() routine for a
subclass of <a href="qtab.html">QTab</a>.
<h3 class="fn">void<a name="d469d7"></a>QTabWidget::insertTab(<a href="qwidget.html">QWidget</a>*child, const<a href="qiconset.html">QIconSet</a>&iconset, const<a href="qstring.html">QString</a>&label, intindex=-1)</h3>
<p>Inserts another tab and page to the tab view.
<p>This function is the same as <a href="#ab9fc5">insertTab</a>() but with an additional
iconset.
<h3 class="fn">void<a name="c6c175"></a>QTabWidget::insertTab(<a href="qwidget.html">QWidget</a>*child, const<a href="qstring.html">QString</a>&label, intindex=-1)</h3>
<p>Inserts another tab and page to the tab view.
<p>The tab will be labelled <em>label</em> and <em>child</em> constitutes the new
page. Note the difference between the widget name (which you supply
to widget constructors and to e.g. <a href="#240827">setTabEnabled</a>()) and the tab
label: The name is internal to the program and invariant, while the
label is shown on screen and may vary according to e.g. language.
<p><em>label</em> is written in the <a href="qbutton.html">QButton</a> style, where &P makes Qt create
an accelerator key on Alt-P for this page. For example:
<p><pre> td->insertTab( graphicsPane, "&Graphics" );
td->insertTab( soundPane, "&Sound" );
</pre>
<p>If <em>index</em> is not specified, the tab is simply added. Otherwise
it's inserted at the specified position.
<p>If the user presses Alt-S the sound page of the tab dialog is shown,
if the user presses Alt-P the graphics page is shown.
<p>If you call <a href="#ab9fc5">insertTab</a>() after <a href="qwidget.html#200ee5">show</a>(), the screen will flicker and the
user will be confused.
<h3 class="fn">bool<a name="973923"></a>QTabWidget::isTabEnabled(<a href="qwidget.html">QWidget</a>*w)const</h3>
<p>Returns TRUE if the page <em>w</em> is enabled, and
false if it is disabled.
<p>See also <a href="#240827">setTabEnabled</a>() and <a href="qwidget.html#f9af61">QWidget::isEnabled</a>().
<h3 class="fn">int<a name="644993"></a>QTabWidget::margin()const</h3>
<p>Returns the width of the margin. The margin is the distance between
the innermost pixel of the frame and the outermost pixel of the
pages.
<p>See also <a href="#13adfc">setMargin</a>().
<h3 class="fn"><a href="qsize.html">QSize</a><a name="808987"></a>QTabWidget::minimumSizeHint()const <code>[virtual]</code></h3>
<p>Returns a suitable minimum size for the tab widget.
<p>Reimplemented from <a href="qwidget.html#553e08">QWidget.</a>
<h3 class="fn">void<a name="e6bb7c"></a>QTabWidget::removePage(<a href="qwidget.html">QWidget</a>*w)</h3>
<p>Removes page <em>w</em> from this stack of widgets. Does not
delete <em>w.</em>
<p>See also <a href="#ac313c">showPage</a>() and <a href="qwidgetstack.html#69ed68">QWidgetStack::removeWidget</a>().
<h3 class="fn">void<a name="feb1c6"></a>QTabWidget::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">void<a name="6d3c6f"></a>QTabWidget::setCurrentPage(intid)</h3>
<p>Sets the page with index <em>id</em> as current page.
<p>Note that <em>id</em> is not the index that is specified when you insert a tab.
<h3 class="fn">void<a name="13adfc"></a>QTabWidget::setMargin(intw)</h3>
<p>Sets the width of the margin to <em>w.</em>
<p>See also <a href="#644993">margin</a>().
<h3 class="fn">void<a name="cd3661"></a>QTabWidget::setTabBar(<a href="qtabbar.html">QTabBar</a>*tb) <code>[protected]</code></h3>
<p>Replaces the <a href="qtabbar.html">QTabBar</a> heading the dialog by the given tab bar.
Note that this must be called <em>before</em> any tabs have been added,
or the behavior is undefined.
<p>See also <a href="#2dda19">tabBar</a>().
<h3 class="fn">void<a name="240827"></a>QTabWidget::setTabEnabled(<a href="qwidget.html">QWidget</a>*w, boolenable)</h3>
<p>Enables/disables page <em>w</em> according to the value of <em>enable,</em> and
redraws the page's tab appropriately.
<p>QTabWidget uses <a href="qwidget.html#4b103c">QWidget::setEnabled</a>() internally, rather than keep a
separate flag.
<p>Note that even a disabled tab/page may be visible. If the page is
visible already, QTabWidget will not hide it, and if all the pages
are disabled, QTabWidget will show one of them.
<p>See also <a href="#973923">isTabEnabled</a>() and <a href="qwidget.html#4b103c">QWidget::setEnabled</a>().
<h3 class="fn">void<a name="18b576"></a>QTabWidget::setTabPosition(<a href="qtabwidget.html#TabPosition">TabPosition</a>pos)</h3>
<p>Sets the position of the tabs to <em>pos</em>
<p>Possible values are QTabWidget::Top and QTabWidget::Bottom.
<p>See also <a href="#c224c8">tabPosition</a>().
<h3 class="fn">void<a name="38f5e4"></a>QTabWidget::setTabShape(<a href="qtabwidget.html#TabShape">TabShape</a>s)</h3>
<p>Sets the shape of the tabs to <em>s.</em>
<h3 class="fn">void<a name="aa4593"></a>QTabWidget::showEvent(<a href="qshowevent.html">QShowEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#542dc0">QWidget.</a>
<h3 class="fn">void<a name="ac313c"></a>QTabWidget::showPage(<a href="qwidget.html">QWidget</a>*w)</h3>
<p>Ensures that <em>w</em> is shown. This is useful mainly for accelerators.<p><b>Warning:</b> Used carelessly, this function can easily surprise or
confuse the user.
<p>See also <a href="qtabbar.html#23184d">QTabBar::setCurrentTab</a>().
<h3 class="fn"><a href="qsize.html">QSize</a><a name="1eea21"></a>QTabWidget::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn"><a href="qsizepolicy.html">QSizePolicy</a><a name="4cce2c"></a>QTabWidget::sizePolicy()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#23726d">QWidget.</a>
<h3 class="fn">void<a name="d2da51"></a>QTabWidget::styleChange(<a href="qstyle.html">QStyle</a>&old) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5e2e23">QWidget.</a>
<h3 class="fn"><a href="qtabbar.html">QTabBar</a>*<a name="2dda19"></a>QTabWidget::tabBar()const <code>[protected]</code></h3>
<p>Returns the currently set <a href="qtabbar.html">QTabBar</a>.
<p>See also <a href="#cd3661">setTabBar</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="9b781c"></a>QTabWidget::tabLabel(<a href="qwidget.html">QWidget</a>*w)</h3>
<p>Returns the text in the tab for page <em>w.</em>
<h3 class="fn">QTabWidget::TabPosition<a name="c224c8"></a>QTabWidget::tabPosition()const</h3>
<p>Returns the position of the tabs.
<p>Possible values are QTabWidget::Top and QTabWidget::Bottom.
<p>See also <a href="#18b576">setTabPosition</a>().
<h3 class="fn">QTabWidget::TabShape<a name="2aba03"></a>QTabWidget::tabShape()const</h3>
<p>Returns the shape of the tabs.
<p>See also <a href="#38f5e4">setTabShape</a>().
<h3 class="fn">void<a name="686be6"></a>QTabWidget::updateMask() <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#b8a07f">QWidget.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|