Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1039

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QStackedLayout Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStackedLayout Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStackedLayout class provides a stack of widgets where only
one widget is visible at a time. <a href="#details">More...</a></p>

<p>Inherits <a href="qlayout.html">QLayout</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qstackedlayout.html#StackingMode-enum">StackingMode</a></b> { StackOne, StackAll }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstackedlayout.html#QStackedLayout">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#QStackedLayout-2">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#QStackedLayout-3">__init__</a></b> (<i>self</i>, QLayout&#160;<i>parentLayout</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#addItem">addItem</a></b> (<i>self</i>, QLayoutItem&#160;<i>item</i>)</li><li><div class="fn" />int <b><a href="qstackedlayout.html#addWidget">addWidget</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" />int <b><a href="qstackedlayout.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qstackedlayout.html#currentIndex">currentIndex</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qstackedlayout.html#currentWidget">currentWidget</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qstackedlayout.html#insertWidget">insertWidget</a></b> (<i>self</i>, int&#160;<i>index</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qstackedlayout.html#itemAt">itemAt</a></b> (<i>self</i>, int)</li><li><div class="fn" />QSize <b><a href="qstackedlayout.html#minimumSize">minimumSize</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#setCurrentIndex">setCurrentIndex</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#setGeometry">setGeometry</a></b> (<i>self</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" /><b><a href="qstackedlayout.html#setStackingMode">setStackingMode</a></b> (<i>self</i>, StackingMode&#160;<i>stackingMode</i>)</li><li><div class="fn" />QSize <b><a href="qstackedlayout.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />StackingMode <b><a href="qstackedlayout.html#stackingMode">stackingMode</a></b> (<i>self</i>)</li><li><div class="fn" />QLayoutItem <b><a href="qstackedlayout.html#takeAt">takeAt</a></b> (<i>self</i>, int)</li><li><div class="fn" />QWidget <b><a href="qstackedlayout.html#widget">widget</a></b> (<i>self</i>, int)</li><li><div class="fn" />QWidget <b><a href="qstackedlayout.html#widget-2">widget</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qstackedlayout.html#currentChanged">currentChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qstackedlayout.html#widgetRemoved">widgetRemoved</a></b> (int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStackedLayout class provides a stack of widgets where only
one widget is visible at a time.</p>
<p>QStackedLayout 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
QStackedLayout.</p>
<p>A QStackedLayout 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">QStackedLayout</span> <span class="operator">*</span>stackedLayout <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QStackedLayout</span>;
     stackedLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(firstPageWidget);
     stackedLayout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(secondPageWidget);
     stackedLayout<span class="operator">-</span><span class="operator">&gt;</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">&gt;</span>addLayout(stackedLayout);
     setLayout(mainLayout);
</pre>
<p>QStackedLayout 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
QStackedLayout'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">&gt;</span>addItem(tr(<span class="string">"Page 1"</span>));
     pageComboBox<span class="operator">-</span><span class="operator">&gt;</span>addItem(tr(<span class="string">"Page 2"</span>));
     pageComboBox<span class="operator">-</span><span class="operator">&gt;</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>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="StackingMode-enum" />QStackedLayout.StackingMode</h3><p>This enum specifies how the layout handles its child widgets
regarding their visibility.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStackedLayout.StackOne</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Only the current widget is visible. This is
the default.</td>
</tr>
<tr>
<td class="topAlign"><tt>QStackedLayout.StackAll</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">All widgets are visible. The current widget is
merely raised.</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.4.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStackedLayout" />QStackedLayout.__init__ (<i>self</i>)</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>


<h3 class="fn"><a name="QStackedLayout-2" />QStackedLayout.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a 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>


<h3 class="fn"><a name="QStackedLayout-3" />QStackedLayout.__init__ (<i>self</i>, <a href="qlayout.html">QLayout</a>&#160;<i>parentLayout</i>)</h3><p>The <i>parentLayout</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="qstackedlayout.html">QStackedLayout</a> and inserts it into the
given <i>parentLayout</i>.</p>


<h3 class="fn"><a name="addItem" />QStackedLayout.addItem (<i>self</i>, <a href="qlayoutitem.html">QLayoutItem</a>&#160;<i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Reimplemented from <a href="qlayout.html#addItem">QLayout.addItem</a>().</p>


<h3 class="fn"><a name="addWidget" />int QStackedLayout.addWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>The <i>w</i> argument has it's ownership transferred to Qt.</p><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>


<h3 class="fn"><a name="count" />int QStackedLayout.count (<i>self</i>)</h3><h3 class="fn"><a name="currentIndex" />int QStackedLayout.currentIndex (<i>self</i>)</h3><h3 class="fn"><a name="currentWidget" /><a href="qwidget.html">QWidget</a> QStackedLayout.currentWidget (<i>self</i>)</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>


<h3 class="fn"><a name="insertWidget" />int QStackedLayout.insertWidget (<i>self</i>, int&#160;<i>index</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>The <i>w</i> argument has it's ownership transferred to Qt.</p><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>


<h3 class="fn"><a name="itemAt" /><a href="qlayoutitem.html">QLayoutItem</a> QStackedLayout.itemAt (<i>self</i>, int)</h3><p>Reimplemented from <a href="qlayout.html#itemAt">QLayout.itemAt</a>().</p>


<h3 class="fn"><a name="minimumSize" /><a href="qsize.html">QSize</a> QStackedLayout.minimumSize (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem.minimumSize</a>().</p>


<h3 class="fn"><a name="setCurrentIndex" />QStackedLayout.setCurrentIndex (<i>self</i>, int&#160;<i>index</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentIndex(int)</tt>.</p><h3 class="fn"><a name="setCurrentWidget" />QStackedLayout.setCurrentWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentWidget(QWidget *)</tt>.</p><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>


<h3 class="fn"><a name="setGeometry" />QStackedLayout.setGeometry (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem.setGeometry</a>().</p>


<h3 class="fn"><a name="setStackingMode" />QStackedLayout.setStackingMode (<i>self</i>, <a href="qstackedlayout.html#StackingMode-enum">StackingMode</a>&#160;<i>stackingMode</i>)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QStackedLayout.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem.sizeHint</a>().</p>


<h3 class="fn"><a name="stackingMode" /><a href="qstackedlayout.html#StackingMode-enum">StackingMode</a> QStackedLayout.stackingMode (<i>self</i>)</h3><h3 class="fn"><a name="takeAt" /><a href="qlayoutitem.html">QLayoutItem</a> QStackedLayout.takeAt (<i>self</i>, int)</h3><p>The <i>QLayoutItem</i> result</p><p>Reimplemented from <a href="qlayout.html#takeAt">QLayout.takeAt</a>().</p>


<h3 class="fn"><a name="widget" /><a href="qwidget.html">QWidget</a> QStackedLayout.widget (<i>self</i>, int)</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>


<h3 class="fn"><a name="widget-2" /><a href="qwidget.html">QWidget</a> QStackedLayout.widget (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentChanged" />void currentChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current 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>See also</b> <a href="qstackedlayout.html#currentWidget">currentWidget</a>() and
<a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget</a>().</p>


<h3 class="fn"><a name="widgetRemoved" />void widgetRemoved (int)</h3><p>This is the default overload of this signal.</p><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>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>