<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstackedwidget.cpp --> <title>QStackedWidget Class | Qt Widgets 5.12.2</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QStackedWidget</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.2 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#public-slots">Public Slots</a></li> <li class="level1"><a href="#signals">Signals</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QStackedWidget Class</h1> <!-- $$$QStackedWidget-brief --> <p>The <a href="qstackedwidget.html">QStackedWidget</a> class provides a stack of widgets where only one widget is visible at a time. <a href="#details">More...</a></p> <!-- @@@QStackedWidget --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QStackedWidget></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qframe.html">QFrame</a></td></tr></table></div><ul> <li><a href="qstackedwidget-members.html">List of all members, including inherited members</a></li> <li><a href="qstackedwidget-obsolete.html">Obsolete members</a></li> </ul> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><a href="qstackedwidget.html#count-prop">count</a></b> : const int</li> <li class="fn"><b><a href="qstackedwidget.html#currentIndex-prop">currentIndex</a></b> : int</li> </ul> <ul> <li class="fn">6 properties inherited from <a href="qframe.html#properties">QFrame</a></li> <li class="fn">59 properties inherited from <a href="qwidget.html#properties">QWidget</a></li> <li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#QStackedWidget">QStackedWidget</a></b>(QWidget *<i>parent</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#dtor.QStackedWidget">~QStackedWidget</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#addWidget">addWidget</a></b>(QWidget *<i>widget</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#count-prop">count</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#currentIndex-prop">currentIndex</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#currentWidget">currentWidget</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#indexOf">indexOf</a></b>(QWidget *<i>widget</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#insertWidget">insertWidget</a></b>(int <i>index</i>, QWidget *<i>widget</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#removeWidget">removeWidget</a></b>(QWidget *<i>widget</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#widget">widget</a></b>(int <i>index</i>) const</td></tr> </table></div> <ul> <li class="fn">14 public functions inherited from <a href="qframe.html#public-functions">QFrame</a></li> <li class="fn">214 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li> <li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li> <li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li> </ul> <a name="public-slots"></a> <h2 id="public-slots">Public Slots</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#currentIndex-prop">setCurrentIndex</a></b>(int <i>index</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a></b>(QWidget *<i>widget</i>)</td></tr> </table></div> <ul> <li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li> <li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li> </ul> <a name="signals"></a> <h2 id="signals">Signals</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#currentChanged">currentChanged</a></b>(int <i>index</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#widgetRemoved">widgetRemoved</a></b>(int <i>index</i>)</td></tr> </table></div> <ul> <li class="fn">3 signals inherited from <a href="qwidget.html#signals">QWidget</a></li> <li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li> <li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li> </ul> <a name="reimplemented-protected-functions"></a> <h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstackedwidget.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr> </table></div> <ul> <li class="fn">4 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li> <li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> <li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">4 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li> <li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> <li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li> <li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li> </ul> <a name="details"></a> <!-- $$$QStackedWidget-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qstackedwidget.html">QStackedWidget</a> class provides a stack of widgets where only one widget is visible at a time.</p> <p><a href="qstackedwidget.html">QStackedWidget</a> can be used to create a user interface similar to the one provided by <a href="qtabwidget.html">QTabWidget</a>. It is a convenience layout widget built on top of the <a href="qstackedlayout.html">QStackedLayout</a> class.</p> <p>Like <a href="qstackedlayout.html">QStackedLayout</a>, <a href="qstackedwidget.html">QStackedWidget</a> can be constructed and populated with a number of child widgets ("pages"):</p> <pre class="cpp"> <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> <span class="operator">*</span>firstPageWidget <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span>; <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> <span class="operator">*</span>secondPageWidget <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span>; <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> <span class="operator">*</span>thirdPageWidget <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span>; <span class="type"><a href="qstackedwidget.html#QStackedWidget">QStackedWidget</a></span> <span class="operator">*</span>stackedWidget <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstackedwidget.html#QStackedWidget">QStackedWidget</a></span>; stackedWidget<span class="operator">-</span><span class="operator">></span>addWidget(firstPageWidget); stackedWidget<span class="operator">-</span><span class="operator">></span>addWidget(secondPageWidget); stackedWidget<span class="operator">-</span><span class="operator">></span>addWidget(thirdPageWidget); <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>; layout<span class="operator">-</span><span class="operator">></span>addWidget(stackedWidget); setLayout(layout); </pre> <p><a href="qstackedwidget.html">QStackedWidget</a> provides no intrinsic means for the user to switch page. This is typically done through a <a href="qcombobox.html">QComboBox</a> or a <a href="qlistwidget.html">QListWidget</a> that stores the titles of the <a href="qstackedwidget.html">QStackedWidget</a>'s pages. For example:</p> <pre class="cpp"> <span class="type"><a href="qcombobox.html">QComboBox</a></span> <span class="operator">*</span>pageComboBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcombobox.html">QComboBox</a></span>; pageComboBox<span class="operator">-</span><span class="operator">></span>addItem(tr(<span class="string">"Page 1"</span>)); pageComboBox<span class="operator">-</span><span class="operator">></span>addItem(tr(<span class="string">"Page 2"</span>)); pageComboBox<span class="operator">-</span><span class="operator">></span>addItem(tr(<span class="string">"Page 3"</span>)); connect(pageComboBox<span class="operator">,</span> SIGNAL(activated(<span class="type">int</span>))<span class="operator">,</span> stackedWidget<span class="operator">,</span> SLOT(setCurrentIndex(<span class="type">int</span>))); </pre> <p>When populating a stacked widget, the widgets are added to an internal list. The <a href="qstackedwidget.html#indexOf">indexOf</a>() function returns the index of a widget in that list. The widgets can either be added to the end of the list using the <a href="qstackedwidget.html#addWidget">addWidget</a>() function, or inserted at a given index using the <a href="qstackedwidget.html#insertWidget">insertWidget</a>() function. The <a href="qstackedwidget.html#removeWidget">removeWidget</a>() function removes a widget from the stacked widget. The number of widgets contained in the stacked widget can be obtained using the <a href="qstackedwidget.html#count-prop">count</a>() function.</p> <p>The <a href="qstackedwidget.html#widget">widget</a>() function returns the widget at a given index position. The index of the widget that is shown on screen is given by <a href="qstackedwidget.html#currentIndex-prop">currentIndex</a>() and can be changed using <a href="qstackedwidget.html#currentIndex-prop">setCurrentIndex</a>(). In a similar manner, the currently shown widget can be retrieved using the <a href="qstackedwidget.html#currentWidget">currentWidget</a>() function, and altered using the <a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a>() function.</p> <p>Whenever the current widget in the stacked widget changes or a widget is removed from the stacked widget, the <a href="qstackedwidget.html#currentChanged">currentChanged</a>() and <a href="qstackedwidget.html#widgetRemoved">widgetRemoved</a>() signals are emitted respectively.</p> </div> <p><b>See also </b><a href="qstackedlayout.html">QStackedLayout</a> and <a href="qtabwidget.html">QTabWidget</a>.</p> <!-- @@@QStackedWidget --> <div class="prop"> <h2>Property Documentation</h2> <!-- $$$count-prop$$$count --> <h3 class="fn" id="count-prop"><a name="count-prop"></a><span class="name">count</span> : const <span class="type">int</span></h3> <p>This property holds the number of widgets contained by this stacked widget</p> <p>By default, this property contains a value of 0.</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>count</b></span>() const</td></tr> </table></div> <p><b>See also </b><a href="qstackedwidget.html#currentIndex-prop">currentIndex</a>() and <a href="qstackedwidget.html#widget">widget</a>().</p> <!-- @@@count --> <!-- $$$currentIndex-prop$$$currentIndex$$$setCurrentIndexint$$$currentChangedint --> <h3 class="fn" id="currentIndex-prop"><a name="currentIndex-prop"></a><span class="name">currentIndex</span> : <span class="type">int</span></h3> <p>This property holds the index position of the widget that is visible</p> <p>The current index is -1 if there is no current widget.</p> <p>By default, this property contains a value of -1 because the stack is initially empty.</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>currentIndex</b></span>() const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCurrentIndex</b></span>(int <i>index</i>)</td></tr> </table></div> <p><b>Notifier signal:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qstackedwidget.html#currentChanged">currentChanged</a></b></span>(int <i>index</i>)</td></tr> </table></div> <p><b>See also </b><a href="qstackedwidget.html#currentWidget">currentWidget</a>() and <a href="qstackedwidget.html#indexOf">indexOf</a>().</p> <!-- @@@currentIndex --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QStackedWidget[overload1]$$$QStackedWidgetQWidget* --> <h3 class="fn" id="QStackedWidget"><a name="QStackedWidget"></a>QStackedWidget::<span class="name">QStackedWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr)</h3> <p>Constructs a <a href="qstackedwidget.html">QStackedWidget</a> with the given <i>parent</i>.</p> <p><b>See also </b><a href="qstackedwidget.html#addWidget">addWidget</a>() and <a href="qstackedwidget.html#insertWidget">insertWidget</a>().</p> <!-- @@@QStackedWidget --> <!-- $$$~QStackedWidget[overload1]$$$~QStackedWidget --> <h3 class="fn" id="dtor.QStackedWidget"><a name="dtor.QStackedWidget"></a><code>[virtual] </code>QStackedWidget::<span class="name">~QStackedWidget</span>()</h3> <p>Destroys this stacked widget, and frees any allocated resources.</p> <!-- @@@~QStackedWidget --> <!-- $$$addWidget[overload1]$$$addWidgetQWidget* --> <h3 class="fn" id="addWidget"><a name="addWidget"></a><span class="type">int</span> QStackedWidget::<span class="name">addWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>)</h3> <p>Appends the given <i>widget</i> to the <a href="qstackedwidget.html">QStackedWidget</a> and returns the index position. Ownership of <i>widget</i> is passed on to the <a href="qstackedwidget.html">QStackedWidget</a>.</p> <p>If the <a href="qstackedwidget.html">QStackedWidget</a> is empty before this function is called, <i>widget</i> becomes the current widget.</p> <p><b>See also </b><a href="qstackedwidget.html#insertWidget">insertWidget</a>(), <a href="qstackedwidget.html#removeWidget">removeWidget</a>(), and <a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@addWidget --> <!-- $$$currentChanged --> <h3 class="fn" id="currentChanged"><a name="currentChanged"></a><code>[signal] </code><span class="type">void</span> QStackedWidget::<span class="name">currentChanged</span>(<span class="type">int</span> <i>index</i>)</h3> <p>This signal is emitted whenever the current widget changes.</p> <p>The parameter holds the <i>index</i> of the new current widget, or -1 if there isn't a new one (for example, if there are no widgets in the <a href="qstackedwidget.html">QStackedWidget</a>).</p> <p><b>Note:</b> Notifier signal for property <a href="qstackedwidget.html#currentIndex-prop">currentIndex</a>. </p><p><b>See also </b><a href="qstackedwidget.html#currentWidget">currentWidget</a>() and <a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@currentChanged --> <!-- $$$currentWidget[overload1]$$$currentWidget --> <h3 class="fn" id="currentWidget"><a name="currentWidget"></a><span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *QStackedWidget::<span class="name">currentWidget</span>() const</h3> <p>Returns the current widget, or 0 if there are no child widgets.</p> <p><b>See also </b><a href="qstackedwidget.html#currentIndex-prop">currentIndex</a>() and <a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@currentWidget --> <!-- $$$event[overload1]$$$eventQEvent* --> <h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QStackedWidget::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3> <p>Reimplemented from <a href="qframe.html#event">QFrame::event</a>().</p> <!-- @@@event --> <!-- $$$indexOf[overload1]$$$indexOfQWidget* --> <h3 class="fn" id="indexOf"><a name="indexOf"></a><span class="type">int</span> QStackedWidget::<span class="name">indexOf</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>) const</h3> <p>Returns the index of the given <i>widget</i>, or -1 if the given <i>widget</i> is not a child of the <a href="qstackedwidget.html">QStackedWidget</a>.</p> <p><b>See also </b><a href="qstackedwidget.html#currentIndex-prop">currentIndex</a>() and <a href="qstackedwidget.html#widget">widget</a>().</p> <!-- @@@indexOf --> <!-- $$$insertWidget[overload1]$$$insertWidgetintQWidget* --> <h3 class="fn" id="insertWidget"><a name="insertWidget"></a><span class="type">int</span> QStackedWidget::<span class="name">insertWidget</span>(<span class="type">int</span> <i>index</i>, <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>)</h3> <p>Inserts the given <i>widget</i> at the given <i>index</i> in the <a href="qstackedwidget.html">QStackedWidget</a>. Ownership of <i>widget</i> is passed on to the <a href="qstackedwidget.html">QStackedWidget</a>. If <i>index</i> is out of range, the <i>widget</i> is appended (in which case it is the actual index of the <i>widget</i> that is returned).</p> <p>If the <a href="qstackedwidget.html">QStackedWidget</a> was empty before this function is called, the given <i>widget</i> becomes the current widget.</p> <p>Inserting a new widget at an index less than or equal to the current index will increment the current index, but keep the current widget.</p> <p><b>See also </b><a href="qstackedwidget.html#addWidget">addWidget</a>(), <a href="qstackedwidget.html#removeWidget">removeWidget</a>(), and <a href="qstackedwidget.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@insertWidget --> <!-- $$$removeWidget[overload1]$$$removeWidgetQWidget* --> <h3 class="fn" id="removeWidget"><a name="removeWidget"></a><span class="type">void</span> QStackedWidget::<span class="name">removeWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>)</h3> <p>Removes <i>widget</i> from the <a href="qstackedwidget.html">QStackedWidget</a>. i.e., <i>widget</i> is <i>not</i> deleted but simply removed from the stacked layout, causing it to be hidden.</p> <p><b>Note: </b>Parent object and parent widget of <i>widget</i> will remain the <a href="qstackedwidget.html">QStackedWidget</a>. If the application wants to reuse the removed <i>widget</i>, then it is recommended to re-parent it.</p><p><b>See also </b><a href="qstackedwidget.html#addWidget">addWidget</a>(), <a href="qstackedwidget.html#insertWidget">insertWidget</a>(), and <a href="qstackedwidget.html#currentWidget">currentWidget</a>().</p> <!-- @@@removeWidget --> <!-- $$$setCurrentWidget[overload1]$$$setCurrentWidgetQWidget* --> <h3 class="fn" id="setCurrentWidget"><a name="setCurrentWidget"></a><code>[slot] </code><span class="type">void</span> QStackedWidget::<span class="name">setCurrentWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>)</h3> <p>Sets the current widget to be the specified <i>widget</i>. The new current widget must already be contained in this stacked widget.</p> <p><b>See also </b><a href="qstackedwidget.html#currentWidget">currentWidget</a>() and <a href="qstackedwidget.html#currentIndex-prop">setCurrentIndex</a>().</p> <!-- @@@setCurrentWidget --> <!-- $$$widget[overload1]$$$widgetint --> <h3 class="fn" id="widget"><a name="widget"></a><span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *QStackedWidget::<span class="name">widget</span>(<span class="type">int</span> <i>index</i>) const</h3> <p>Returns the widget at the given <i>index</i>, or 0 if there is no such widget.</p> <p><b>See also </b><a href="qstackedwidget.html#currentWidget">currentWidget</a>() and <a href="qstackedwidget.html#indexOf">indexOf</a>().</p> <!-- @@@widget --> <!-- $$$widgetRemoved[overload1]$$$widgetRemovedint --> <h3 class="fn" id="widgetRemoved"><a name="widgetRemoved"></a><code>[signal] </code><span class="type">void</span> QStackedWidget::<span class="name">widgetRemoved</span>(<span class="type">int</span> <i>index</i>)</h3> <p>This signal is emitted whenever a widget is removed. The widget's <i>index</i> is passed as parameter.</p> <p><b>See also </b><a href="qstackedwidget.html#removeWidget">removeWidget</a>().</p> <!-- @@@widgetRemoved --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>