<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstackedlayout.cpp --> <title>QStackedLayout Class | Qt Widgets 5.12.6</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 >QStackedLayout</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.6 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="#public-types">Public Types</a></li> <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="#reimplemented-public-functions">Reimplemented 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="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QStackedLayout Class</h1> <!-- $$$QStackedLayout-brief --> <p>The <a href="qstackedlayout.html">QStackedLayout</a> class provides a stack of widgets where only one widget is visible at a time. <a href="#details">More...</a></p> <!-- @@@QStackedLayout --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QStackedLayout></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="qlayout.html">QLayout</a></td></tr></table></div><ul> <li><a href="qstackedlayout-members.html">List of all members, including inherited members</a></li> <li><a href="qstackedlayout-obsolete.html">Obsolete members</a></li> </ul> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#StackingMode-enum">StackingMode</a></b> { StackOne, StackAll }</td></tr> </table></div> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><a href="qstackedlayout.html#count-prop">count</a></b> : const int</li> <li class="fn"><b><a href="qstackedlayout.html#currentIndex-prop">currentIndex</a></b> : int</li> <li class="fn"><b><a href="qstackedlayout.html#stackingMode-prop">stackingMode</a></b> : StackingMode</li> </ul> <ul> <li class="fn">2 properties inherited from <a href="qlayout.html#properties">QLayout</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="qstackedlayout.html#QStackedLayout">QStackedLayout</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#QStackedLayout-1">QStackedLayout</a></b>(QWidget *<i>parent</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#QStackedLayout-2">QStackedLayout</a></b>(QLayout *<i>parentLayout</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#dtor.QStackedLayout">~QStackedLayout</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.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="qstackedlayout.html#currentIndex-prop">currentIndex</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#currentWidget">currentWidget</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.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="qstackedlayout.html#stackingMode-prop">setStackingMode</a></b>(QStackedLayout::StackingMode <i>stackingMode</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStackedLayout::StackingMode </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#stackingMode-prop">stackingMode</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#widget">widget</a></b>(int <i>index</i>) const</td></tr> </table></div> <a name="reimplemented-public-functions"></a> <h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#addItem">addItem</a></b>(QLayoutItem *<i>item</i>) override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#count-prop">count</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#hasHeightForWidth">hasHeightForWidth</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#heightForWidth">heightForWidth</a></b>(int <i>width</i>) const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QLayoutItem *</td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#itemAt">itemAt</a></b>(int <i>index</i>) const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#minimumSize">minimumSize</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#setGeometry">setGeometry</a></b>(const QRect &<i>rect</i>) override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#sizeHint">sizeHint</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QLayoutItem *</td><td class="memItemRight bottomAlign"><b><a href="qstackedlayout.html#takeAt">takeAt</a></b>(int <i>index</i>) override</td></tr> </table></div> <ul> <li class="fn">37 public functions inherited from <a href="qlayout.html#public-functions">QLayout</a></li> <li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li> <li class="fn">17 public functions inherited from <a href="qlayoutitem.html#public-functions">QLayoutItem</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="qstackedlayout.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="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a></b>(QWidget *<i>widget</i>)</td></tr> </table></div> <ul> <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="qstackedlayout.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="qstackedlayout.html#widgetRemoved">widgetRemoved</a></b>(int <i>index</i>)</td></tr> </table></div> <ul> <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="qstackedlayout.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">1 static public member inherited from <a href="qlayout.html#static-public-members">QLayout</a></li> <li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">4 protected functions inherited from <a href="qlayout.html#protected-functions">QLayout</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QStackedLayout-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qstackedlayout.html">QStackedLayout</a> class provides a stack of widgets where only one widget is visible at a time.</p> <p><a href="qstackedlayout.html">QStackedLayout</a> can be used to create a user interface similar to the one provided by <a href="qtabwidget.html">QTabWidget</a>. There is also a convenience <a href="qstackedwidget.html">QStackedWidget</a> class built on top of <a href="qstackedlayout.html">QStackedLayout</a>.</p> <p>A <a href="qstackedlayout.html">QStackedLayout</a> can be populated with a number of child widgets ("pages"). For example:</p> <pre class="cpp"> <span class="type"><a href="qwidget.html">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</a></span>; <span class="type"><a href="qwidget.html">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</a></span>; <span class="type"><a href="qwidget.html">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</a></span>; <span class="type"><a href="qstackedlayout.html#QStackedLayout">QStackedLayout</a></span> <span class="operator">*</span>stackedLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstackedlayout.html#QStackedLayout">QStackedLayout</a></span>; stackedLayout<span class="operator">-</span><span class="operator">></span>addWidget(firstPageWidget); stackedLayout<span class="operator">-</span><span class="operator">></span>addWidget(secondPageWidget); stackedLayout<span class="operator">-</span><span class="operator">></span>addWidget(thirdPageWidget); <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>mainLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>; mainLayout<span class="operator">-</span><span class="operator">></span>addLayout(stackedLayout); setLayout(mainLayout); </pre> <p><a href="qstackedlayout.html">QStackedLayout</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="qstackedlayout.html">QStackedLayout</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> stackedLayout<span class="operator">,</span> SLOT(setCurrentIndex(<span class="type">int</span>))); </pre> <p>When populating a layout, the widgets are added to an internal list. The <a href="qlayout.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="qstackedlayout.html#addWidget">addWidget</a>() function, or inserted at a given index using the <a href="qstackedlayout.html#insertWidget">insertWidget</a>() function. The <a href="qlayout.html#removeWidget">removeWidget</a>() function removes the widget at the given index from the layout. The number of widgets contained in the layout, can be obtained using the <a href="qstackedlayout.html#count-prop">count</a>() function.</p> <p>The <a href="qstackedlayout.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="qstackedlayout.html#currentIndex-prop">currentIndex</a>() and can be changed using <a href="qstackedlayout.html#currentIndex-prop">setCurrentIndex</a>(). In a similar manner, the currently shown widget can be retrieved using the <a href="qstackedlayout.html#currentWidget">currentWidget</a>() function, and altered using the <a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a>() function.</p> <p>Whenever the current widget in the layout changes or a widget is removed from the layout, the <a href="qstackedlayout.html#currentChanged">currentChanged</a>() and <a href="qstackedlayout.html#widgetRemoved">widgetRemoved</a>() signals are emitted respectively.</p> </div> <p><b>See also </b><a href="qstackedwidget.html">QStackedWidget</a> and <a href="qtabwidget.html">QTabWidget</a>.</p> <!-- @@@QStackedLayout --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$StackingMode$$$StackOne$$$StackAll --> <h3 class="fn" id="StackingMode-enum"><a name="StackingMode-enum"></a>enum QStackedLayout::<span class="name">StackingMode</span></h3> <p>This enum specifies how the layout handles its child widgets regarding their visibility.</p> <div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><code>QStackedLayout::StackOne</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Only the current widget is visible. This is the default.</td></tr> <tr><td class="topAlign"><code>QStackedLayout::StackAll</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">All widgets are visible. The current widget is merely raised.</td></tr> </table></div> <p>This enum was introduced or modified in Qt 4.4.</p> <!-- @@@StackingMode --> </div> <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 in the layout</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> virtual int </td><td class="memItemRight bottomAlign"><span class="name"><b>count</b></span>() const override</td></tr> </table></div> <p><b>See also </b><a href="qstackedlayout.html#currentIndex-prop">currentIndex</a>() and <a href="qstackedlayout.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><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="qstackedlayout.html#currentChanged">currentChanged</a></b></span>(int <i>index</i>)</td></tr> </table></div> <p><b>See also </b><a href="qstackedlayout.html#currentWidget">currentWidget</a>() and <a href="qlayout.html#indexOf">indexOf</a>().</p> <!-- @@@currentIndex --> <!-- $$$stackingMode-prop$$$stackingMode$$$setStackingModeQStackedLayout::StackingMode --> <h3 class="fn" id="stackingMode-prop"><a name="stackingMode-prop"></a><span class="name">stackingMode</span> : <span class="type"><a href="qstackedlayout.html#StackingMode-enum">StackingMode</a></span></h3> <p>determines the way visibility of child widgets are handled.</p> <p>The default value is <a href="qstackedlayout.html#StackingMode-enum">StackOne</a>. Setting the property to <a href="qstackedlayout.html#StackingMode-enum">StackAll</a> allows you to make use of the layout for overlay widgets that do additional drawing on top of other widgets, for example, graphical editors.</p> <p>This property was introduced in Qt 4.4.</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QStackedLayout::StackingMode </td><td class="memItemRight bottomAlign"><span class="name"><b>stackingMode</b></span>() const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStackingMode</b></span>(QStackedLayout::StackingMode <i>stackingMode</i>)</td></tr> </table></div> <!-- @@@stackingMode --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QStackedLayout[overload1]$$$QStackedLayout --> <h3 class="fn" id="QStackedLayout"><a name="QStackedLayout"></a>QStackedLayout::<span class="name">QStackedLayout</span>()</h3> <p>Constructs a <a href="qstackedlayout.html">QStackedLayout</a> with no parent.</p> <p>This <a href="qstackedlayout.html">QStackedLayout</a> must be installed on a widget later on to become effective.</p> <p><b>See also </b><a href="qstackedlayout.html#addWidget">addWidget</a>() and <a href="qstackedlayout.html#insertWidget">insertWidget</a>().</p> <!-- @@@QStackedLayout --> <!-- $$$QStackedLayout$$$QStackedLayoutQWidget* --> <h3 class="fn" id="QStackedLayout-1"><a name="QStackedLayout-1"></a>QStackedLayout::<span class="name">QStackedLayout</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>parent</i>)</h3> <p>Constructs a new <a href="qstackedlayout.html">QStackedLayout</a> with the given <i>parent</i>.</p> <p>This layout will install itself on the <i>parent</i> widget and manage the geometry of its children.</p> <!-- @@@QStackedLayout --> <!-- $$$QStackedLayout$$$QStackedLayoutQLayout* --> <h3 class="fn" id="QStackedLayout-2"><a name="QStackedLayout-2"></a>QStackedLayout::<span class="name">QStackedLayout</span>(<span class="type"><a href="qlayout.html#QLayout">QLayout</a></span> *<i>parentLayout</i>)</h3> <p>Constructs a new <a href="qstackedlayout.html">QStackedLayout</a> and inserts it into the given <i>parentLayout</i>.</p> <!-- @@@QStackedLayout --> <!-- $$$~QStackedLayout[overload1]$$$~QStackedLayout --> <h3 class="fn" id="dtor.QStackedLayout"><a name="dtor.QStackedLayout"></a><code>[virtual] </code>QStackedLayout::<span class="name">~QStackedLayout</span>()</h3> <p>Destroys this <a href="qstackedlayout.html">QStackedLayout</a>. Note that the layout's widgets are <i>not</i> destroyed.</p> <!-- @@@~QStackedLayout --> <!-- $$$addItem[overload1]$$$addItemQLayoutItem* --> <h3 class="fn" id="addItem"><a name="addItem"></a><code>[override virtual] </code><span class="type">void</span> QStackedLayout::<span class="name">addItem</span>(<span class="type"><a href="qlayoutitem.html#QLayoutItem">QLayoutItem</a></span> *<i>item</i>)</h3> <p>Reimplemented from <a href="qlayout.html#addItem">QLayout::addItem</a>().</p> <!-- @@@addItem --> <!-- $$$addWidget[overload1]$$$addWidgetQWidget* --> <h3 class="fn" id="addWidget"><a name="addWidget"></a><span class="type">int</span> QStackedLayout::<span class="name">addWidget</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3> <p>Adds the given <i>widget</i> to the end of this layout and returns the index position of the <i>widget</i>.</p> <p>If the <a href="qstackedlayout.html">QStackedLayout</a> is empty before this function is called, the given <i>widget</i> becomes the current widget.</p> <p><b>See also </b><a href="qstackedlayout.html#insertWidget">insertWidget</a>(), <a href="qlayout.html#removeWidget">removeWidget</a>(), and <a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@addWidget --> <!-- $$$currentChanged --> <h3 class="fn" id="currentChanged"><a name="currentChanged"></a><code>[signal] </code><span class="type">void</span> QStackedLayout::<span class="name">currentChanged</span>(<span class="type">int</span> <i>index</i>)</h3> <p>This signal is emitted whenever the current widget in the layout changes. The <i>index</i> specifies the index 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="qstackedlayout.html">QStackedLayout</a>)</p> <p><b>Note:</b> Notifier signal for property <a href="qstackedlayout.html#currentIndex-prop">currentIndex</a>. </p><p><b>See also </b><a href="qstackedlayout.html#currentWidget">currentWidget</a>() and <a href="qstackedlayout.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</a></span> *QStackedLayout::<span class="name">currentWidget</span>() const</h3> <p>Returns the current widget, or 0 if there are no widgets in this layout.</p> <p><b>See also </b><a href="qstackedlayout.html#currentIndex-prop">currentIndex</a>() and <a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@currentWidget --> <!-- $$$hasHeightForWidth[overload1]$$$hasHeightForWidth --> <h3 class="fn" id="hasHeightForWidth"><a name="hasHeightForWidth"></a><code>[override virtual] </code><span class="type">bool</span> QStackedLayout::<span class="name">hasHeightForWidth</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem::hasHeightForWidth</a>().</p> <!-- @@@hasHeightForWidth --> <!-- $$$heightForWidth[overload1]$$$heightForWidthint --> <h3 class="fn" id="heightForWidth"><a name="heightForWidth"></a><code>[override virtual] </code><span class="type">int</span> QStackedLayout::<span class="name">heightForWidth</span>(<span class="type">int</span> <i>width</i>) const</h3> <p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem::heightForWidth</a>().</p> <!-- @@@heightForWidth --> <!-- $$$insertWidget[overload1]$$$insertWidgetintQWidget* --> <h3 class="fn" id="insertWidget"><a name="insertWidget"></a><span class="type">int</span> QStackedLayout::<span class="name">insertWidget</span>(<span class="type">int</span> <i>index</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3> <p>Inserts the given <i>widget</i> at the given <i>index</i> in this <a href="qstackedlayout.html">QStackedLayout</a>. If <i>index</i> is out of range, the widget is appended (in which case it is the actual index of the <i>widget</i> that is returned).</p> <p>If the <a href="qstackedlayout.html">QStackedLayout</a> is 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="qstackedlayout.html#addWidget">addWidget</a>(), <a href="qlayout.html#removeWidget">removeWidget</a>(), and <a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a>().</p> <!-- @@@insertWidget --> <!-- $$$itemAt[overload1]$$$itemAtint --> <h3 class="fn" id="itemAt"><a name="itemAt"></a><code>[override virtual] </code><span class="type"><a href="qlayoutitem.html#QLayoutItem">QLayoutItem</a></span> *QStackedLayout::<span class="name">itemAt</span>(<span class="type">int</span> <i>index</i>) const</h3> <p>Reimplemented from <a href="qlayout.html#itemAt">QLayout::itemAt</a>().</p> <!-- @@@itemAt --> <!-- $$$minimumSize[overload1]$$$minimumSize --> <h3 class="fn" id="minimumSize"><a name="minimumSize"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QStackedLayout::<span class="name">minimumSize</span>() const</h3> <p>Reimplemented from <a href="qlayout.html#minimumSize">QLayout::minimumSize</a>().</p> <!-- @@@minimumSize --> <!-- $$$setCurrentWidget[overload1]$$$setCurrentWidgetQWidget* --> <h3 class="fn" id="setCurrentWidget"><a name="setCurrentWidget"></a><code>[slot] </code><span class="type">void</span> QStackedLayout::<span class="name">setCurrentWidget</span>(<span class="type"><a href="qwidget.html">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 layout.</p> <p><b>See also </b><a href="qstackedlayout.html#currentIndex-prop">setCurrentIndex</a>() and <a href="qstackedlayout.html#currentWidget">currentWidget</a>().</p> <!-- @@@setCurrentWidget --> <!-- $$$setGeometry[overload1]$$$setGeometryconstQRect& --> <h3 class="fn" id="setGeometry"><a name="setGeometry"></a><code>[override virtual] </code><span class="type">void</span> QStackedLayout::<span class="name">setGeometry</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &<i>rect</i>)</h3> <p>Reimplemented from <a href="qlayout.html#setGeometry">QLayout::setGeometry</a>().</p> <!-- @@@setGeometry --> <!-- $$$sizeHint[overload1]$$$sizeHint --> <h3 class="fn" id="sizeHint"><a name="sizeHint"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QStackedLayout::<span class="name">sizeHint</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem::sizeHint</a>().</p> <!-- @@@sizeHint --> <!-- $$$takeAt[overload1]$$$takeAtint --> <h3 class="fn" id="takeAt"><a name="takeAt"></a><code>[override virtual] </code><span class="type"><a href="qlayoutitem.html#QLayoutItem">QLayoutItem</a></span> *QStackedLayout::<span class="name">takeAt</span>(<span class="type">int</span> <i>index</i>)</h3> <p>Reimplemented from <a href="qlayout.html#takeAt">QLayout::takeAt</a>().</p> <!-- @@@takeAt --> <!-- $$$widget[overload1]$$$widgetint --> <h3 class="fn" id="widget"><a name="widget"></a><span class="type"><a href="qwidget.html">QWidget</a></span> *QStackedLayout::<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 widget at the given position.</p> <p><b>See also </b><a href="qstackedlayout.html#currentWidget">currentWidget</a>() and <a href="qlayout.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> QStackedLayout::<span class="name">widgetRemoved</span>(<span class="type">int</span> <i>index</i>)</h3> <p>This signal is emitted whenever a widget is removed from the layout. The widget's <i>index</i> is passed as parameter.</p> <p><b>See also </b><a href="qlayout.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>