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 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTabWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" 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="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTabWidget Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTabWidget class provides a stack of tabbed widgets.
<a href="#details">More...</a></p>
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtabwidget.html#TabPosition-enum">TabPosition</a></b> { North, South, West, East }</li><li><div class="fn" />enum <b><a href="qtabwidget.html#TabShape-enum">TabShape</a></b> { Rounded, Triangular }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtabwidget.html#QTabWidget">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />int <b><a href="qtabwidget.html#addTab">addTab</a></b> (<i>self</i>, QWidget <i>widget</i>, QString)</li><li><div class="fn" />int <b><a href="qtabwidget.html#addTab-2">addTab</a></b> (<i>self</i>, QWidget <i>widget</i>, QIcon <i>icon</i>, QString <i>label</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qtabwidget.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qtabwidget.html#cornerWidget">cornerWidget</a></b> (<i>self</i>, Qt.Corner <i>corner</i> = Qt.TopRightCorner)</li><li><div class="fn" />int <b><a href="qtabwidget.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtabwidget.html#currentIndex">currentIndex</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qtabwidget.html#currentWidget">currentWidget</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#documentMode">documentMode</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextElideMode <b><a href="qtabwidget.html#elideMode">elideMode</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />int <b><a href="qtabwidget.html#heightForWidth">heightForWidth</a></b> (<i>self</i>, int <i>width</i>)</li><li><div class="fn" />QSize <b><a href="qtabwidget.html#iconSize">iconSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtabwidget.html#indexOf">indexOf</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionTabWidgetFrame <i>option</i>)</li><li><div class="fn" />int <b><a href="qtabwidget.html#insertTab">insertTab</a></b> (<i>self</i>, int <i>index</i>, QWidget <i>widget</i>, QString)</li><li><div class="fn" />int <b><a href="qtabwidget.html#insertTab-2">insertTab</a></b> (<i>self</i>, int <i>index</i>, QWidget <i>widget</i>, QIcon <i>icon</i>, QString <i>label</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#isMovable">isMovable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#isTabEnabled">isTabEnabled</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" />QSize <b><a href="qtabwidget.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qtabwidget.html#removeTab">removeTab</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qtabwidget.html#setCornerWidget">setCornerWidget</a></b> (<i>self</i>, QWidget <i>widget</i>, Qt.Corner <i>corner</i> = Qt.TopRightCorner)</li><li><div class="fn" /><b><a href="qtabwidget.html#setCurrentIndex">setCurrentIndex</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setCurrentWidget">setCurrentWidget</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setDocumentMode">setDocumentMode</a></b> (<i>self</i>, bool <i>set</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setElideMode">setElideMode</a></b> (<i>self</i>, Qt.TextElideMode)</li><li><div class="fn" /><b><a href="qtabwidget.html#setIconSize">setIconSize</a></b> (<i>self</i>, QSize <i>size</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setMovable">setMovable</a></b> (<i>self</i>, bool <i>movable</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabBar">setTabBar</a></b> (<i>self</i>, QTabBar)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabEnabled">setTabEnabled</a></b> (<i>self</i>, int <i>index</i>, bool)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabIcon">setTabIcon</a></b> (<i>self</i>, int <i>index</i>, QIcon <i>icon</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabPosition">setTabPosition</a></b> (<i>self</i>, TabPosition)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabsClosable">setTabsClosable</a></b> (<i>self</i>, bool <i>closeable</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabShape">setTabShape</a></b> (<i>self</i>, TabShape <i>s</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabText">setTabText</a></b> (<i>self</i>, int <i>index</i>, QString)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabToolTip">setTabToolTip</a></b> (<i>self</i>, int <i>index</i>, QString <i>tip</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setTabWhatsThis">setTabWhatsThis</a></b> (<i>self</i>, int <i>index</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#setUsesScrollButtons">setUsesScrollButtons</a></b> (<i>self</i>, bool <i>useButtons</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" />QSize <b><a href="qtabwidget.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QTabBar <b><a href="qtabwidget.html#tabBar">tabBar</a></b> (<i>self</i>)</li><li><div class="fn" />QIcon <b><a href="qtabwidget.html#tabIcon">tabIcon</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#tabInserted">tabInserted</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />TabPosition <b><a href="qtabwidget.html#tabPosition">tabPosition</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtabwidget.html#tabRemoved">tabRemoved</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#tabsClosable">tabsClosable</a></b> (<i>self</i>)</li><li><div class="fn" />TabShape <b><a href="qtabwidget.html#tabShape">tabShape</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtabwidget.html#tabText">tabText</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />QString <b><a href="qtabwidget.html#tabToolTip">tabToolTip</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />QString <b><a href="qtabwidget.html#tabWhatsThis">tabWhatsThis</a></b> (<i>self</i>, int <i>index</i>)</li><li><div class="fn" />bool <b><a href="qtabwidget.html#usesScrollButtons">usesScrollButtons</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qtabwidget.html#widget">widget</a></b> (<i>self</i>, int <i>index</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />int <b><a href="qtabwidget.html#__len__">__len__</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qtabwidget.html#currentChanged">currentChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qtabwidget.html#tabCloseRequested">tabCloseRequested</a></b> (int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTabWidget class provides a stack of tabbed widgets.</p>
<p>A tab widget provides a tab bar (see <a href="qtabbar.html">QTabBar</a>) and a "page area" that is used to
display pages related to each tab. By default, the tab bar is shown
above the page area, but different configurations are available
(see <a href="qtabwidget.html#TabPosition-enum">TabPosition</a>).
Each tab is associated with a different widget (called a page).
Only the current page is shown in the page area; all the other
pages are hidden. The user can show a different page by clicking on
its tab or by pressing its Alt+<i>letter</i> shortcut if it has
one.</p>
<p>The normal way to use QTabWidget is to do the following:</p>
<ol class="1">
<li>Create a QTabWidget.</li>
<li>Create a <a href="qwidget.html">QWidget</a> for each of the
pages in the tab dialog, but do not specify parent widgets for
them.</li>
<li>Insert child widgets into the page widget, using layouts to
position them as normal.</li>
<li>Call <a href="qtabwidget.html#addTab">addTab</a>() or <a href="qtabwidget.html#insertTab">insertTab</a>() to put the page widgets
into the tab widget, giving each tab a suitable label with an
optional keyboard shortcut.</li>
</ol>
<p>The position of the tabs is defined by <a href="qtabwidget.html#tabPosition-prop">tabPosition</a>, their shape by
<a href="qtabwidget.html#tabShape-prop">tabShape</a>.</p>
<p>The signal <a href="qtabwidget.html#currentChanged">currentChanged</a>() is emitted
when the user selects a page.</p>
<p>The current page index is available as <a href="qtabwidget.html#currentIndex-prop">currentIndex</a>(), the current
page widget with <a href="qtabwidget.html#currentWidget">currentWidget</a>(). You can
retrieve a pointer to a page widget with a given index using
<a href="qtabwidget.html#widget">widget</a>(), and can find the
index position of a widget with <a href="qtabwidget.html#indexOf">indexOf</a>(). Use <a href="qtabwidget.html#setCurrentWidget">setCurrentWidget</a>() or
<a href="qtabwidget.html#currentIndex-prop">setCurrentIndex</a>()
to show a particular page.</p>
<p>You can change a tab's text and icon using <a href="qtabwidget.html#setTabText">setTabText</a>() or <a href="qtabwidget.html#setTabIcon">setTabIcon</a>(). A tab and its
associated page can be removed with <a href="qtabwidget.html#removeTab">removeTab</a>().</p>
<p>Each tab is either enabled or disabled at any given time (see
<a href="qtabwidget.html#setTabEnabled">setTabEnabled</a>()). If a
tab is enabled, the tab text is drawn normally and the user can
select that tab. If it is disabled, the tab is 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>
<p>Tab widgets can be a very good way to split up a complex dialog.
An alternative is to use a <a href="qstackedwidget.html">QStackedWidget</a> for which you provide some
means of navigating between pages, for example, a <a href="qtoolbar.html">QToolBar</a> or a <a href="qlistwidget.html">QListWidget</a>.</p>
<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="qstackedwidget.html">QStackedWidget</a> (most of the
area, organizing the individual pages).</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Windows XP style tab widget" src="images/windowsxp-tabwidget.png" /></td>
<td><img alt="Screenshot of a Macintosh style tab widget" src="images/macintosh-tabwidget.png" /></td>
<td><img alt="Screenshot of a Plastique style tab widget" src="images/plastique-tabwidget.png" /></td>
</tr>
<tr class="even" valign="top">
<td>A Windows XP style tab widget.</td>
<td>A Macintosh style tab widget.</td>
<td>A Plastique style tab widget.</td>
</tr>
</table>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="TabPosition-enum" />QTabWidget.TabPosition</h3><p>This enum type defines where <a href="qtabwidget.html">QTabWidget</a> draws the tab row:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.North</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The tabs are drawn above the pages.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.South</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The tabs are drawn below the pages.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.West</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The tabs are drawn to the left of the
pages.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.East</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The tabs are drawn to the right of the
pages.</td>
</tr>
</table>
<h3 class="fn"><a name="TabShape-enum" />QTabWidget.TabShape</h3><p>This enum type defines the shape of the tabs:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.Rounded</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The tabs are drawn with a rounded look. This
is the default shape.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTabWidget.Triangular</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The tabs are drawn with a triangular
look.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTabWidget" />QTabWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a tabbed widget with parent <i>parent</i>.</p>
<h3 class="fn"><a name="addTab" />int QTabWidget.addTab (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, QString)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds a tab with the given <i>page</i> and <i>label</i> to the
tab widget, and returns the index of the tab in the tab bar.</p>
<p>If the tab's <i>label</i> contains an ampersand, the letter
following the ampersand is used as a shortcut for the tab, e.g. if
the label is "Bro&wse" then Alt+W becomes a shortcut which will
move the focus to this tab.</p>
<p><b>Note:</b> If you call addTab() after <a href="qwidget.html#show">show</a>(), the layout system will try to
adjust to the changes in its widgets hierarchy and may cause
flicker. To prevent this, you can set the <a href="qwidget.html#updatesEnabled-prop">QWidget.updatesEnabled</a>
property to false prior to changes; remember to set the property to
true when the changes are done, making the widget receive paint
events again.</p>
<p><b>See also</b> <a href="qtabwidget.html#insertTab">insertTab</a>().</p>
<h3 class="fn"><a name="addTab-2" />int QTabWidget.addTab (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, <a href="qicon.html">QIcon</a> <i>icon</i>, QString <i>label</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>This is an overloaded function.</p>
<p>Adds a tab with the given <i>page</i>, <i>icon</i>, and
<i>label</i> to the tab widget, and returns the index of the tab in
the tab bar.</p>
<p>This function is the same as <a href="qtabwidget.html#addTab">addTab</a>(), but with an additional
<i>icon</i>.</p>
<h3 class="fn"><a name="changeEvent" />QTabWidget.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>
<h3 class="fn"><a name="clear" />QTabWidget.clear (<i>self</i>)</h3><p>Removes all the pages, but does not delete them. Calling this
function is equivalent to calling <a href="qtabwidget.html#removeTab">removeTab</a>() until the tab widget is
empty.</p>
<h3 class="fn"><a name="cornerWidget" /><a href="qwidget.html">QWidget</a> QTabWidget.cornerWidget (<i>self</i>, <a href="qt.html#Corner-enum">Qt.Corner</a> <i>corner</i> = Qt.TopRightCorner)</h3><p>Returns the widget shown in the <i>corner</i> of the tab widget
or 0.</p>
<p><b>See also</b> <a href="qtabwidget.html#setCornerWidget">setCornerWidget</a>().</p>
<h3 class="fn"><a name="count" />int QTabWidget.count (<i>self</i>)</h3><h3 class="fn"><a name="currentIndex" />int QTabWidget.currentIndex (<i>self</i>)</h3><h3 class="fn"><a name="currentWidget" /><a href="qwidget.html">QWidget</a> QTabWidget.currentWidget (<i>self</i>)</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).</p>
<p><b>See also</b> <a href="qtabwidget.html#currentIndex-prop">currentIndex</a>() and <a href="qtabwidget.html#setCurrentWidget">setCurrentWidget</a>().</p>
<h3 class="fn"><a name="documentMode" />bool QTabWidget.documentMode (<i>self</i>)</h3><h3 class="fn"><a name="elideMode" /><a href="qt.html#TextElideMode-enum">Qt.TextElideMode</a> QTabWidget.elideMode (<i>self</i>)</h3><h3 class="fn"><a name="event" />bool QTabWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<h3 class="fn"><a name="heightForWidth" />int QTabWidget.heightForWidth (<i>self</i>, int <i>width</i>)</h3><p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget.heightForWidth</a>().</p>
<p>This function was introduced in Qt 4.8.</p>
<h3 class="fn"><a name="iconSize" /><a href="qsize.html">QSize</a> QTabWidget.iconSize (<i>self</i>)</h3><h3 class="fn"><a name="indexOf" />int QTabWidget.indexOf (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>Returns the index position of the page occupied by the widget
<i>w</i>, or -1 if the widget cannot be found.</p>
<h3 class="fn"><a name="initStyleOption" />QTabWidget.initStyleOption (<i>self</i>, <a href="qstyleoptiontabwidgetframe.html">QStyleOptionTabWidgetFrame</a> <i>option</i>)</h3><p>Initialize <i>option</i> with the values from this <a href="qtabwidget.html">QTabWidget</a>. This method is useful for
subclasses when they need a <a href="qstyleoptiontabwidgetframe.html">QStyleOptionTabWidgetFrame</a>,
but don't want to fill in all the information themselves.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>() and
<a href="qtabbar.html#initStyleOption">QTabBar.initStyleOption</a>().</p>
<h3 class="fn"><a name="insertTab" />int QTabWidget.insertTab (<i>self</i>, int <i>index</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, QString)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Inserts a tab with the given <i>label</i> and <i>page</i> into
the tab widget at the specified <i>index</i>, and returns the index
of the inserted tab in the tab bar.</p>
<p>The label is displayed in the tab and may vary in appearance
depending on the configuration of the tab widget.</p>
<p>If the tab's <i>label</i> contains an ampersand, the letter
following the ampersand is used as a shortcut for the tab, e.g. if
the label is "Bro&wse" then Alt+W becomes a shortcut which will
move the focus to this tab.</p>
<p>If <i>index</i> is out of range, the tab is simply appended.
Otherwise it is inserted at the specified position.</p>
<p>If the <a href="qtabwidget.html">QTabWidget</a> was empty before
this function is called, the new page becomes the current page.
Inserting a new tab at an index less than or equal to the current
index will increment the current index, but keep the current
page.</p>
<p><b>Note:</b> If you call insertTab() after <a href="qwidget.html#show">show</a>(), the layout system will try to
adjust to the changes in its widgets hierarchy and may cause
flicker. To prevent this, you can set the <a href="qwidget.html#updatesEnabled-prop">QWidget.updatesEnabled</a>
property to false prior to changes; remember to set the property to
true when the changes are done, making the widget receive paint
events again.</p>
<p><b>See also</b> <a href="qtabwidget.html#addTab">addTab</a>().</p>
<h3 class="fn"><a name="insertTab-2" />int QTabWidget.insertTab (<i>self</i>, int <i>index</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, <a href="qicon.html">QIcon</a> <i>icon</i>, QString <i>label</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><h3 class="fn"><a name="isMovable" />bool QTabWidget.isMovable (<i>self</i>)</h3><h3 class="fn"><a name="isTabEnabled" />bool QTabWidget.isTabEnabled (<i>self</i>, int <i>index</i>)</h3><p>Returns true if the page at position <i>index</i> is enabled;
otherwise returns false.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabEnabled">setTabEnabled</a>() and <a href="qwidget.html#enabled-prop">QWidget.isEnabled</a>().</p>
<h3 class="fn"><a name="keyPressEvent" />QTabWidget.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>
<h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QTabWidget.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>
<p>Returns a suitable minimum size for the tab widget.</p>
<h3 class="fn"><a name="paintEvent" />QTabWidget.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>Paints the tab widget's tab bar in response to the paint
<i>event</i>.</p>
<h3 class="fn"><a name="removeTab" />QTabWidget.removeTab (<i>self</i>, int <i>index</i>)</h3><p>Removes the tab at position <i>index</i> from this stack of
widgets. The page widget itself is not deleted.</p>
<p><b>See also</b> <a href="qtabwidget.html#addTab">addTab</a>()
and <a href="qtabwidget.html#insertTab">insertTab</a>().</p>
<h3 class="fn"><a name="resizeEvent" />QTabWidget.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<h3 class="fn"><a name="setCornerWidget" />QTabWidget.setCornerWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, <a href="qt.html#Corner-enum">Qt.Corner</a> <i>corner</i> = Qt.TopRightCorner)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Sets the given <i>widget</i> to be shown in the specified
<i>corner</i> of the tab widget. The geometry of the widget is
determined based on the widget's <a href="qtabwidget.html#sizeHint">sizeHint</a>() and the <a href="qwidget.html#style">style</a>().</p>
<p>Only the horizontal element of the <i>corner</i> will be
used.</p>
<p>Passing 0 shows no widget in the corner.</p>
<p>Any previously set corner widget is hidden.</p>
<p>All widgets set here will be deleted by the tab widget when it
is destroyed unless you separately reparent the widget after
setting some other corner widget (or 0).</p>
<p>Note: Corner widgets are designed for <a href="qtabwidget.html#TabPosition-enum">North</a> and <a href="qtabwidget.html#TabPosition-enum">South</a> tab positions; other
orientations are known to not work properly.</p>
<p><b>See also</b> <a href="qtabwidget.html#cornerWidget">cornerWidget</a>() and <a href="qtabwidget.html#tabPosition-prop">setTabPosition</a>().</p>
<h3 class="fn"><a name="setCurrentIndex" />QTabWidget.setCurrentIndex (<i>self</i>, int <i>index</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentIndex(int)</tt>.</p><h3 class="fn"><a name="setCurrentWidget" />QTabWidget.setCurrentWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentWidget( ::QWidget*)</tt>.</p><p>Makes <i>widget</i> the current widget. The <i>widget</i> used
must be a page in this tab widget.</p>
<p><b>See also</b> <a href="qtabwidget.html#addTab">addTab</a>(),
<a href="qtabwidget.html#currentIndex-prop">setCurrentIndex</a>(),
and <a href="qtabwidget.html#currentWidget">currentWidget</a>().</p>
<h3 class="fn"><a name="setDocumentMode" />QTabWidget.setDocumentMode (<i>self</i>, bool <i>set</i>)</h3><h3 class="fn"><a name="setElideMode" />QTabWidget.setElideMode (<i>self</i>, <a href="qt.html#TextElideMode-enum">Qt.TextElideMode</a>)</h3><h3 class="fn"><a name="setIconSize" />QTabWidget.setIconSize (<i>self</i>, <a href="qsize.html">QSize</a> <i>size</i>)</h3><h3 class="fn"><a name="setMovable" />QTabWidget.setMovable (<i>self</i>, bool <i>movable</i>)</h3><h3 class="fn"><a name="setTabBar" />QTabWidget.setTabBar (<i>self</i>, <a href="qtabbar.html">QTabBar</a>)</h3><p>The <i>QTabBar</i> argument has it's ownership transferred to Qt.</p><p>Replaces the dialog's <a href="qtabbar.html">QTabBar</a> heading
with the tab bar <i>tb</i>. Note that this must be called
<i>before</i> any tabs have been added, or the behavior is
undefined.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabBar">tabBar</a>().</p>
<h3 class="fn"><a name="setTabEnabled" />QTabWidget.setTabEnabled (<i>self</i>, int <i>index</i>, bool)</h3><p>If <i>enable</i> is true, the page at position <i>index</i> is
enabled; otherwise the page at position <i>index</i> is disabled.
The page's tab is redrawn appropriately.</p>
<p><a href="qtabwidget.html">QTabWidget</a> uses <a href="qwidget.html#enabled-prop">QWidget.setEnabled</a>() internally,
rather than keeping a separate flag.</p>
<p>Note that even a disabled tab/page may be visible. If the page
is visible already, <a href="qtabwidget.html">QTabWidget</a> will
not hide it; if all the pages are disabled, <a href="qtabwidget.html">QTabWidget</a> will show one of them.</p>
<p><b>See also</b> <a href="qtabwidget.html#isTabEnabled">isTabEnabled</a>() and <a href="qwidget.html#enabled-prop">QWidget.setEnabled</a>().</p>
<h3 class="fn"><a name="setTabIcon" />QTabWidget.setTabIcon (<i>self</i>, int <i>index</i>, <a href="qicon.html">QIcon</a> <i>icon</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the <i>icon</i> for the tab at position <i>index</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabIcon">tabIcon</a>().</p>
<h3 class="fn"><a name="setTabPosition" />QTabWidget.setTabPosition (<i>self</i>, <a href="qtabwidget.html#TabPosition-enum">TabPosition</a>)</h3><h3 class="fn"><a name="setTabsClosable" />QTabWidget.setTabsClosable (<i>self</i>, bool <i>closeable</i>)</h3><h3 class="fn"><a name="setTabShape" />QTabWidget.setTabShape (<i>self</i>, <a href="qtabwidget.html#TabShape-enum">TabShape</a> <i>s</i>)</h3><h3 class="fn"><a name="setTabText" />QTabWidget.setTabText (<i>self</i>, int <i>index</i>, QString)</h3><p>Defines a new <i>label</i> for the page at position
<i>index</i>'s tab.</p>
<p>If the provided text contains an ampersand character ('&'),
a shortcut is automatically created for it. The character that
follows the '&' will be used as the shortcut key. Any previous
shortcut will be overwritten, or cleared if no shortcut is defined
by the text. See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details
(to display an actual ampersand, use '&&').</p>
<p><b>See also</b> <a href="qtabwidget.html#tabText">tabText</a>().</p>
<h3 class="fn"><a name="setTabToolTip" />QTabWidget.setTabToolTip (<i>self</i>, int <i>index</i>, QString <i>tip</i>)</h3><p>Sets the tab tool tip for the page at position <i>index</i> to
<i>tip</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabToolTip">tabToolTip</a>().</p>
<h3 class="fn"><a name="setTabWhatsThis" />QTabWidget.setTabWhatsThis (<i>self</i>, int <i>index</i>, QString <i>text</i>)</h3><p>Sets the What's This help text for the page at position
<i>index</i> to <i>text</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabWhatsThis">tabWhatsThis</a>().</p>
<h3 class="fn"><a name="setUsesScrollButtons" />QTabWidget.setUsesScrollButtons (<i>self</i>, bool <i>useButtons</i>)</h3><h3 class="fn"><a name="showEvent" />QTabWidget.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#showEvent">QWidget.showEvent</a>().</p>
<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QTabWidget.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
<h3 class="fn"><a name="tabBar" /><a href="qtabbar.html">QTabBar</a> QTabWidget.tabBar (<i>self</i>)</h3><p>Returns the current <a href="qtabbar.html">QTabBar</a>.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabBar">setTabBar</a>().</p>
<h3 class="fn"><a name="tabIcon" /><a href="qicon.html">QIcon</a> QTabWidget.tabIcon (<i>self</i>, int <i>index</i>)</h3><p>Returns the icon for the tab on the page at position
<i>index</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabIcon">setTabIcon</a>().</p>
<h3 class="fn"><a name="tabInserted" />QTabWidget.tabInserted (<i>self</i>, int <i>index</i>)</h3><p>This virtual handler is called after a new tab was added or
inserted at position <i>index</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabRemoved">tabRemoved</a>().</p>
<h3 class="fn"><a name="tabPosition" /><a href="qtabwidget.html#TabPosition-enum">TabPosition</a> QTabWidget.tabPosition (<i>self</i>)</h3><h3 class="fn"><a name="tabRemoved" />QTabWidget.tabRemoved (<i>self</i>, int <i>index</i>)</h3><p>This virtual handler is called after a tab was removed from
position <i>index</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabInserted">tabInserted</a>().</p>
<h3 class="fn"><a name="tabsClosable" />bool QTabWidget.tabsClosable (<i>self</i>)</h3><h3 class="fn"><a name="tabShape" /><a href="qtabwidget.html#TabShape-enum">TabShape</a> QTabWidget.tabShape (<i>self</i>)</h3><h3 class="fn"><a name="tabText" />QString QTabWidget.tabText (<i>self</i>, int <i>index</i>)</h3><p>Returns the label text for the tab on the page at position
<i>index</i>.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabText">setTabText</a>().</p>
<h3 class="fn"><a name="tabToolTip" />QString QTabWidget.tabToolTip (<i>self</i>, int <i>index</i>)</h3><p>Returns the tab tool tip for the page at position <i>index</i>
or an empty string if no tool tip has been set.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabToolTip">setTabToolTip</a>().</p>
<h3 class="fn"><a name="tabWhatsThis" />QString QTabWidget.tabWhatsThis (<i>self</i>, int <i>index</i>)</h3><p>Returns the What's This help text for the page at position
<i>index</i>, or an empty string if no help text has been set.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtabwidget.html#setTabWhatsThis">setTabWhatsThis</a>().</p>
<h3 class="fn"><a name="usesScrollButtons" />bool QTabWidget.usesScrollButtons (<i>self</i>)</h3><h3 class="fn"><a name="widget" /><a href="qwidget.html">QWidget</a> QTabWidget.widget (<i>self</i>, int <i>index</i>)</h3><p>Returns the tab page at index position <i>index</i> or 0 if the
<i>index</i> is out of range.</p>
<h3 class="fn"><a name="__len__" />int QTabWidget.__len__ (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentChanged" />void currentChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current page index changes.
The parameter is the new current page <i>index</i> position, or -1
if there isn't a new one (for example, if there are no widgets in
the <a href="qtabwidget.html">QTabWidget</a>)</p>
<p><b>See also</b> <a href="qtabwidget.html#currentWidget">currentWidget</a>() and <a href="qtabwidget.html#currentIndex-prop">currentIndex</a>.</p>
<h3 class="fn"><a name="tabCloseRequested" />void tabCloseRequested (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the close button on a tab is
clicked. The <i>index</i> is the index that should be removed.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtabwidget.html#tabsClosable-prop">setTabsClosable</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|