<class name="QStackedWidget" doc="/** <p>The <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> class provides a stack of widgets where only one widget is visible at a time.</p> <p><a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> can be used to create a user interface similar to the one provided by <a href="QTabWidget.html"><tt>QTabWidget</tt></a>. It is a convenience layout widget built on top of the <a href="QStackedLayout.html"><tt>QStackedLayout</tt></a> class.</p> <p>Like <a href="QStackedLayout.html"><tt>QStackedLayout</tt></a>, <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> can be constructed and populated with a number of child widgets (&quot;pages&quot;):</p> <pre> QWidget *firstPageWidget = new QWidget; QWidget *secondPageWidget = new QWidget; QWidget *thirdPageWidget = new QWidget; QStackedWidget *stackedWidget = new QStackedWidget; stackedWidget-&gt;addWidget(firstPageWidget); stackedWidget-&gt;addWidget(secondPageWidget); stackedWidget-&gt;addWidget(thirdPageWidget); QVBoxLayout *layout = new QVBoxLayout; layout-&gt;addWidget(stackedWidget); setLayout(layout);</pre> <p><a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> provides no intrinsic means for the user to switch page. This is typically done through a <a href="QComboBox.html"><tt>QComboBox</tt></a> or a <a href="QListWidget.html"><tt>QListWidget</tt></a> that stores the titles of the <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>'s pages. For example:</p> <pre> QComboBox *pageComboBox = new QComboBox; pageComboBox-&gt;addItem(tr(&quot;Page 1&quot;)); pageComboBox-&gt;addItem(tr(&quot;Page 2&quot;)); pageComboBox-&gt;addItem(tr(&quot;Page 3&quot;)); connect(pageComboBox, SIGNAL(activated(int)), stackedWidget, SLOT(setCurrentIndex(int)));</pre> <p>When populating a stacked widget, the widgets are added to an internal list. The <a href="QStackedWidget.html#indexOf(com.trolltech.qt.gui.QWidget)"><tt>indexOf</tt></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(com.trolltech.qt.gui.QWidget)"><tt>addWidget</tt></a> function, or inserted at a given index using the <a href="QStackedWidget.html#insertWidget(int, com.trolltech.qt.gui.QWidget)"><tt>insertWidget</tt></a> function. The <a href="QStackedWidget.html#removeWidget(com.trolltech.qt.gui.QWidget)"><tt>removeWidget</tt></a> function removes the widget at the given index from the stacked widget. The number of widgets contained in the stacked widget, can be obtained using the <a href="QStackedWidget.html#count()"><tt>count</tt></a> function.</p> <p>The <a href="QStackedWidget.html#widget(int)"><tt>widget</tt></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()"><tt>currentIndex</tt></a> and can be changed using <a href="QStackedWidget.html#setCurrentIndex(int)"><tt>setCurrentIndex</tt></a>. In a similar manner, the currently shown widget can be retrieved using the <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> function, and altered using the <a href="QStackedWidget.html#setCurrentWidget(com.trolltech.qt.gui.QWidget)"><tt>setCurrentWidget</tt></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(int)"><tt>currentChanged</tt></a> and <a href="QStackedWidget.html#widgetRemoved(int)"><tt>widgetRemoved</tt></a> signals are emitted respectively.</p> @see <a href="QStackedLayout.html"><tt>QStackedLayout</tt></a> @see <a href="QTabWidget.html"><tt>QTabWidget</tt></a> @see <a href="%2E%2E/qtjambi-configdialog.html">Config Dialog Example</tt></a> */"> <signal name="protected final void currentChanged(int arg__1)" doc="/** <p>This signal is emitted whenever the current widget changes.</p> <p>The parameter holds the <tt>arg__1</tt> 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(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>).</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(int arg__1)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a>, <a href="QStackedWidget.html#setCurrentWidget(com.trolltech.qt.gui.QWidget)"><tt>setCurrentWidget</tt></a></dd> </dl> */"/> <signal name="protected final void customContextMenuRequested(com.trolltech.qt.core.QPoint pos)" doc="/** <p>This signal is emitted when the widget's <a href="QWidget.html#contextMenuPolicy()"><tt>contextMenuPolicy</tt></a> is Qt::CustomContextMenu, and the user has requested a context menu on the widget. The position <tt>pos</tt> is the position of the context menu event that the widget receives. Normally this is in widget coordinates. The exception to this rule is <a href="QAbstractScrollArea.html"><tt>QAbstractScrollArea</tt></a> and its subclasses that map the context menu event to coordinates of the viewport()</tt> .</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(com.trolltech.qt.core.QPoint pos)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QWidget.html#mapToGlobal(com.trolltech.qt.core.QPoint)"><tt>mapToGlobal</tt></a>, <a href="QMenu.html"><tt>QMenu</tt></a>, <a href="QWidget.html#contextMenuPolicy()"><tt>contextMenuPolicy</tt></a></dd> </dl> */"/> <signal name="protected final void widgetRemoved(int index)" doc="/** <p>This signal is emitted whenever a widget is removed. The widget's <tt>index</tt> is passed as parameter.</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(int index)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QStackedWidget.html#removeWidget(com.trolltech.qt.gui.QWidget)"><tt>removeWidget</tt></a></dd> </dl> */"/> <method name="public QStackedWidget(com.trolltech.qt.gui.QWidget parent)" doc="/** <p>Constructs a <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> with the given <tt>parent</tt>.</p> @see <a href="QStackedWidget.html#addWidget(com.trolltech.qt.gui.QWidget)"><tt>addWidget</tt></a> @see <a href="QStackedWidget.html#insertWidget(int, com.trolltech.qt.gui.QWidget)"><tt>insertWidget</tt></a> */"/> <method name="public QStackedWidget()" doc="/** <p>Equivalent to <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>(0). */"/> <method name="public final int addWidget(com.trolltech.qt.gui.QWidget w)" doc="/** <p>Appends the given <tt>w</tt> to this <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> and returns the index position.</p> <p>If the <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> is empty before this function is called, <tt>w</tt> becomes the current widget.</p> @see <a href="QStackedWidget.html#insertWidget(int, com.trolltech.qt.gui.QWidget)"><tt>insertWidget</tt></a> @see <a href="QStackedWidget.html#removeWidget(com.trolltech.qt.gui.QWidget)"><tt>removeWidget</tt></a> @see <a href="QStackedWidget.html#setCurrentWidget(com.trolltech.qt.gui.QWidget)"><tt>setCurrentWidget</tt></a> */"/> <method name="public final int count()" doc="/** <p>Returns the number of widgets contained by this stacked widget.</p> @see <a href="QStackedWidget.html#currentIndex()"><tt>currentIndex</tt></a> @see <a href="QStackedWidget.html#widget(int)"><tt>widget</tt></a> */"/> <method name="public final int currentIndex()" doc="/** <p>Returns the index position of the widget that is visible.</p> <p>The current index is -1 if there is no current widget.</p> @see <a href="QStackedWidget.html#setCurrentIndex(int)"><tt>setCurrentIndex</tt></a> @see <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> @see <a href="QStackedWidget.html#indexOf(com.trolltech.qt.gui.QWidget)"><tt>indexOf</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QWidget currentWidget()" doc="/** <p>Returns the current widget, or 0 if there are no child widgets.</p> @see <a href="QStackedWidget.html#currentIndex()"><tt>currentIndex</tt></a> @see <a href="QStackedWidget.html#setCurrentWidget(com.trolltech.qt.gui.QWidget)"><tt>setCurrentWidget</tt></a> */"/> <method name="public final int indexOf(com.trolltech.qt.gui.QWidget arg__1)" doc="/** <p>Returns the index of the given <tt>arg__1</tt>, or -1 if the given <tt>arg__1</tt> is not a child of this <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>.</p> @see <a href="QStackedWidget.html#currentIndex()"><tt>currentIndex</tt></a> @see <a href="QStackedWidget.html#widget(int)"><tt>widget</tt></a> */"/> <method name="public final int insertWidget(int index, com.trolltech.qt.gui.QWidget w)" doc="/** <p>Inserts the given <tt>w</tt> at the given <tt>index</tt> in this <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>. If <tt>index</tt> is out of range, the <tt>w</tt> is appended (in which case it is the actual index of the <tt>w</tt> that is returned).</p> <p>If the <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a> was empty before this function is called, the given <tt>w</tt> 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> @see <a href="QStackedWidget.html#addWidget(com.trolltech.qt.gui.QWidget)"><tt>addWidget</tt></a> @see <a href="QStackedWidget.html#removeWidget(com.trolltech.qt.gui.QWidget)"><tt>removeWidget</tt></a> @see <a href="QStackedWidget.html#setCurrentWidget(com.trolltech.qt.gui.QWidget)"><tt>setCurrentWidget</tt></a> */"/> <method name="public final void removeWidget(com.trolltech.qt.gui.QWidget w)" doc="/** <p>Removes the given <tt>w</tt> from this <a href="QStackedWidget.html#QStackedWidget(com.trolltech.qt.gui.QWidget)"><tt>QStackedWidget</tt></a>. The widget is <i>not</i> deleted.</p> @see <a href="QStackedWidget.html#addWidget(com.trolltech.qt.gui.QWidget)"><tt>addWidget</tt></a> @see <a href="QStackedWidget.html#insertWidget(int, com.trolltech.qt.gui.QWidget)"><tt>insertWidget</tt></a> @see <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> */"/> <method name="public final void setCurrentIndex(int index)" doc="/** <p>Sets the index position of the widget that is visible to <tt>index</tt>.</p> <p>The current index is -1 if there is no current widget.</p> @see <a href="QStackedWidget.html#currentIndex()"><tt>currentIndex</tt></a> @see <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> @see <a href="QStackedWidget.html#indexOf(com.trolltech.qt.gui.QWidget)"><tt>indexOf</tt></a> */"/> <method name="public final void setCurrentWidget(com.trolltech.qt.gui.QWidget w)" doc="/** <p>Sets the current widget to be the specified <tt>w</tt>. The new current widget must already be contained in this stacked widget.</p> @see <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> @see <a href="QStackedWidget.html#setCurrentIndex(int)"><tt>setCurrentIndex</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QWidget widget(int arg__1)" doc="/** <p>Returns the widget at the given <tt>arg__1</tt>, or 0 if there is no such widget.</p> @see <a href="QStackedWidget.html#currentWidget()"><tt>currentWidget</tt></a> @see <a href="QStackedWidget.html#indexOf(com.trolltech.qt.gui.QWidget)"><tt>indexOf</tt></a> */"/> <method name="public boolean event(com.trolltech.qt.core.QEvent e)" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> </class>