<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstackedwidget.cpp --> <title>Qt 4.8: QStackedWidget Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtgui.html">QtGui</a></li> <li>QStackedWidget</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <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="#protected-functions">Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QStackedWidget Class Reference</h1> <!-- $$$QStackedWidget-brief --> <p>The QStackedWidget class provides a stack of widgets where only one widget is visible at a time. <a href="#details">More...</a></p> <!-- @@@QStackedWidget --> <pre class="cpp"> <span class="preprocessor">#include <QStackedWidget></span></pre><p><b>Inherits: </b><a href="qframe.html">QFrame</a>.</p> <ul> <li><a href="qstackedwidget-members.html">List of all members, including inherited members</a></li> </ul> <a name="properties"></a> <h2>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">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li> <li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li> </ul> <a name="public-functions"></a> <h2>Public Functions</h2> <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> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </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> <ul> <li class="fn">14 public functions inherited from <a href="qframe.html#public-functions">QFrame</a></li> <li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li> <li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> <li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li> </ul> <a name="public-slots"></a> <h2>Public Slots</h2> <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> <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="qobject.html#public-slots">QObject</a></li> </ul> <a name="signals"></a> <h2>Signals</h2> <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> <ul> <li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li> <li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li> </ul> <a name="reimplemented-protected-functions"></a> <h2>Reimplemented Protected Functions</h2> <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> )</td></tr> </table> <ul> <li class="fn">3 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li> <li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li> <li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> <li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li> <li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> <li class="fn">3 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li> <li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li> <li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> <li class="fn">1 protected function inherited from <a href="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>Detailed Description</h2> <p>The QStackedWidget class provides a stack of widgets where only one widget is visible at a time.</p> <p>QStackedWidget 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>, QStackedWidget can be constructed and populated with a number of child widgets ("pages"):</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">QStackedWidget</span> <span class="operator">*</span>stackedWidget <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QStackedWidget</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>QStackedWidget 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 QStackedWidget'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>, <a href="qtabwidget.html">QTabWidget</a>, and <a href="dialogs-configdialog.html">Config Dialog Example</a>.</p> <!-- @@@QStackedWidget --> <div class="prop"> <h2>Property Documentation</h2> <!-- $$$count-prop$$$count --> <h3 class="fn"><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> <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> <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"><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> <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> <p><b>Notifier signal:</b></p> <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> <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"><a name="QStackedWidget"></a>QStackedWidget::<span class="name">QStackedWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</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"><a name="dtor.QStackedWidget"></a>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"><a name="addWidget"></a><span class="type">int</span> QStackedWidget::<span class="name">addWidget</span> ( <span class="type"><a href="qwidget.html">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[overload1]$$$currentChangedint --> <h3 class="fn"><a name="currentChanged"></a><span class="type">void</span> QStackedWidget::<span class="name">currentChanged</span> ( <span class="type">int</span> <i>index</i> )<tt> [signal]</tt></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>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"><a name="currentWidget"></a><span class="type"><a href="qwidget.html">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"><a name="event"></a><span class="type">bool</span> QStackedWidget::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3> <p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p> <!-- @@@event --> <!-- $$$indexOf[overload1]$$$indexOfQWidget* --> <h3 class="fn"><a name="indexOf"></a><span class="type">int</span> QStackedWidget::<span class="name">indexOf</span> ( <span class="type"><a href="qwidget.html">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"><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</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"><a name="removeWidget"></a><span class="type">void</span> QStackedWidget::<span class="name">removeWidget</span> ( <span class="type"><a href="qwidget.html">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> Ownership of <i>widget</i> reverts to the application.</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"><a name="setCurrentWidget"></a><span class="type">void</span> QStackedWidget::<span class="name">setCurrentWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )<tt> [slot]</tt></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"><a name="widget"></a><span class="type"><a href="qwidget.html">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"><a name="widgetRemoved"></a><span class="type">void</span> QStackedWidget::<span class="name">widgetRemoved</span> ( <span class="type">int</span> <i>index</i> )<tt> [signal]</tt></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 class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> 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.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>