Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QStackedLayout Class Reference

The QStackedLayout class provides a stack of widgets where only one widget is visible at a time. More...

Inheritance diagram for QtGui.QStackedLayout:
Collaboration diagram for QtGui.QStackedLayout:

Public Types

enum  StackingMode { StackAll = 1, StackOne = 0 }
  More...
 
- Public Types inherited from QtGui.QLayout
enum  SizeConstraint {
  SetDefaultConstraint = 0, SetFixedSize = 3, SetMaximumSize = 4, SetMinAndMaxSize = 5,
  SetMinimumSize = 2, SetNoConstraint = 1
}
  More...
 

Public Member Functions

 QStackedLayout ()
 
 
 QStackedLayout (QWidget parent)
 
 
 QStackedLayout (QLayout parentLayout)
 
 
override void CreateProxy ()
 
override void AddItem (IQLayoutItem item)
 
 
new int AddWidget (QWidget w)
 
 
override int Count ()
 
 
new int InsertWidget (int index, QWidget w)
 
 
override IQLayoutItem ItemAt (int arg1)
 
 
override QSize MinimumSize ()
 
 
override QSize SizeHint ()
 
 
override IQLayoutItem TakeAt (int arg1)
 
 
new QWidget Widget (int arg1)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QLayout
 QLayout ()
 
 
 QLayout (QWidget parent)
 
 
new bool Activate ()
 
 
new void AddWidget (QWidget w)
 
 
new QRect ContentsRect ()
 
 
virtual Qt.Orientation ExpandingDirections ()
 
 
new void GetContentsMargins (ref int left, ref int top, ref int right, ref int bottom)
 
 
virtual int IndexOf (QWidget arg1)
 
 
virtual void Invalidate ()
 
 
virtual bool IsEmpty ()
 
 
new bool IsEnabled ()
 
 
virtual QLayout Layout ()
 
 
virtual QSize MaximumSize ()
 
 
new QWidget ParentWidget ()
 
 
new void RemoveItem (IQLayoutItem arg1)
 
 
new void RemoveWidget (QWidget w)
 
 
new bool SetAlignment (QWidget w, Qt.AlignmentFlag alignment)
 
 
new bool SetAlignment (QLayout l, Qt.AlignmentFlag alignment)
 
 
new void SetContentsMargins (int left, int top, int right, int bottom)
 
 
new void SetEnabled (bool arg1)
 
 
new int TotalHeightForWidth (int w)
 
new QSize TotalMaximumSize ()
 
new QSize TotalMinimumSize ()
 
new QSize TotalSizeHint ()
 
new void Update ()
 
 
new void Dispose ()
 
new QSizePolicy.ControlType ControlTypes ()
 
virtual bool HasHeightForWidth ()
 
virtual int HeightForWidth (int arg1)
 
virtual int MinimumHeightForWidth (int arg1)
 
virtual QSpacerItem SpacerItem ()
 
virtual QWidget Widget ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool OnEvent (QEvent arg1)
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
- Public Member Functions inherited from QtGui.IQLayoutItem
new QSizePolicy.ControlType ControlTypes ()
 
Qt.Orientation ExpandingDirections ()
 
bool HasHeightForWidth ()
 
int HeightForWidth (int arg1)
 
void Invalidate ()
 
bool IsEmpty ()
 
QLayout Layout ()
 
QSize MaximumSize ()
 
int MinimumHeightForWidth (int arg1)
 
QSize MinimumSize ()
 
QSize SizeHint ()
 
QSpacerItem SpacerItem ()
 
QWidget Widget ()
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtGui.QLayout
static QSize ClosestAcceptableSize (QWidget w, QSize s)
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QStackedLayout (System.Type dummy)
 
new void OnCurrentChanged (int index)
 
 
new void OnWidgetRemoved (int index)
 
 
- Protected Member Functions inherited from QtGui.QLayout
 QLayout (System.Type dummy)
 
new void AddChildLayout (QLayout l)
 
 
new void AddChildWidget (QWidget w)
 
 
new QRect AlignmentRect (QRect arg1)
 
 
override void OnChildEvent (QChildEvent e)
 
 
new void OnWidgetEvent (QEvent arg1)
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

Slot< System.Int32 > WidgetRemoved
 
 
Slot< System.Int32 > CurrentChanged
 
 
new QWidget CurrentWidget [get, set]
 
 
override QRect Geometry [get, set]
 
 
new int CurrentIndex [get, set]
 
 
new StackingMode stackingMode [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQStackedLayoutSignals Emit [get]
 
- Properties inherited from QtGui.QLayout
virtual EventHandler
< QEventArgs< QEvent > > 
WidgetEvent
 
new Qt.AlignmentFlag Alignment [get, set]
 
 
new QMargins ContentsMargins [get, set]
 
 
virtual QRect Geometry [get, set]
 
 
new QWidget MenuBar [get, set]
 
 
new int Margin [get, set]
 
 
new int Spacing [get, set]
 
 
new SizeConstraint sizeConstraint [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new Qt.AlignmentFlag Align [get, set]
 
new IQLayoutSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtGui.IQLayoutItem
Qt.AlignmentFlag Alignment [get, set]
 
QRect Geometry [get, set]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QStackedLayout class provides a stack of widgets where only one widget is visible at a time.

QStackedLayout can be used to create a user interface similar to the one provided by QTabWidget. There is also a convenience QStackedWidget class built on top of QStackedLayout.

A QStackedLayout can be populated with a number of child widgets ("pages"). For example:

QWidget *firstPageWidget = new QWidget;

QWidget *secondPageWidget = new QWidget;

QWidget *thirdPageWidget = new QWidget;

QStackedLayout *stackedLayout = new QStackedLayout;

stackedLayout->addWidget(firstPageWidget);

stackedLayout->addWidget(secondPageWidget);

stackedLayout->addWidget(thirdPageWidget);

QVBoxLayout *mainLayout = new QVBoxLayout;

mainLayout->addLayout(stackedLayout);

setLayout(mainLayout);

QStackedLayout provides no intrinsic means for the user to switch page. This is typically done through a QComboBox or a QListWidget that stores the titles of the QStackedLayout's pages. For example:

QComboBox *pageComboBox = new QComboBox;

pageComboBox->addItem(tr("Page 1"));

pageComboBox->addItem(tr("Page 2"));

pageComboBox->addItem(tr("Page 3"));

connect(pageComboBox, SIGNAL(activated(int)),

stackedLayout, SLOT(setCurrentIndex(int)));

When populating a layout, the widgets are added to an internal list. The indexOf() function returns the index of a widget in that list. The widgets can either be added to the end of the list using the addWidget() function, or inserted at a given index using the insertWidget() function. The removeWidget() function removes the widget at the given index from the layout. The number of widgets contained in the layout, can be obtained using the count() function.

The widget() function returns the widget at a given index position. The index of the widget that is shown on screen is given by currentIndex() and can be changed using setCurrentIndex(). In a similar manner, the currently shown widget can be retrieved using the currentWidget() function, and altered using the setCurrentWidget() function.

Whenever the current widget in the layout changes or a widget is removed from the layout, the currentChanged() and widgetRemoved() signals are emitted respectively.

See also QStackedWidget and QTabWidget.

Member Enumeration Documentation

This enum specifies how the layout handles its child widgets regarding their visibility.

This enum was introduced or modified in Qt 4.4.

Enumerator:
StackAll 

All widgets are visible. The current widget is merely raised.

StackOne 

Only the current widget is visible. This is the default.

Constructor & Destructor Documentation

QtGui.QStackedLayout.QStackedLayout ( System.Type  dummy)
protected
QtGui.QStackedLayout.QStackedLayout ( )

Constructs a QStackedLayout with no parent.

This QStackedLayout must be installed on a widget later on to become effective.

See also addWidget() and insertWidget().

QtGui.QStackedLayout.QStackedLayout ( QWidget  parent)

Constructs a new QStackedLayout with the given parent.

This layout will install itself on the parent widget and manage the geometry of its children.

QtGui.QStackedLayout.QStackedLayout ( QLayout  parentLayout)

Constructs a new QStackedLayout and inserts it into the given parentLayout.

Member Function Documentation

override void QtGui.QStackedLayout.AddItem ( IQLayoutItem  item)
virtual

Reimplemented from QLayout::addItem().

Implements QtGui.QLayout.

new int QtGui.QStackedLayout.AddWidget ( QWidget  w)

Adds the given widget to the end of this layout and returns the index position of the widget.

If the QStackedLayout is empty before this function is called, the given widget becomes the current widget.

See also insertWidget(), removeWidget(), and setCurrentWidget().

override int QtGui.QStackedLayout.Count ( )
virtual

Must be implemented in subclasses to return the number of items in the layout.

See also itemAt().

Implements QtGui.QLayout.

override void QtGui.QStackedLayout.CreateProxy ( )
virtual

Reimplemented from QtGui.QLayout.

new void QtGui.QStackedLayout.Dispose ( )
new int QtGui.QStackedLayout.InsertWidget ( int  index,
QWidget  w 
)

Inserts the given widget at the given index in this QStackedLayout. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).

If the QStackedLayout is empty before this function is called, the given widget becomes the current widget.

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.

See also addWidget(), removeWidget(), and setCurrentWidget().

override IQLayoutItem QtGui.QStackedLayout.ItemAt ( int  arg1)
virtual

Reimplemented from QLayout::itemAt().

Implements QtGui.QLayout.

override QSize QtGui.QStackedLayout.MinimumSize ( )
virtual

Reimplemented from QLayoutItem::minimumSize().

Reimplemented from QtGui.QLayout.

new void QtGui.QStackedLayout.OnCurrentChanged ( int  index)
protected

This signal is emitted whenever the current widget in the layout changes. The index 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 QStackedLayout)

See also currentWidget() and setCurrentWidget().

new void QtGui.QStackedLayout.OnWidgetRemoved ( int  index)
protected

This signal is emitted whenever a widget is removed from the layout. The widget's index is passed as parameter.

See also removeWidget().

override QSize QtGui.QStackedLayout.SizeHint ( )
virtual

Reimplemented from QLayoutItem::sizeHint().

Implements QtGui.QLayout.

override IQLayoutItem QtGui.QStackedLayout.TakeAt ( int  arg1)
virtual

Reimplemented from QLayout::takeAt().

Implements QtGui.QLayout.

static string QtGui.QStackedLayout.Tr ( string  s,
string  c = null 
)
static
static string QtGui.QStackedLayout.Tr ( string  s,
string  c,
int  n 
)
static
static string QtGui.QStackedLayout.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtGui.QStackedLayout.TrUtf8 ( string  s,
string  c,
int  n 
)
static
new QWidget QtGui.QStackedLayout.Widget ( int  arg1)

Returns the widget at the given index, or 0 if there is no widget at the given position.

See also currentWidget() and indexOf().

Property Documentation

Slot<System.Int32> QtGui.QStackedLayout.CurrentChanged
addremove

This signal is emitted whenever the current widget in the layout changes. The index 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 QStackedLayout)

See also currentWidget() and setCurrentWidget().

new int QtGui.QStackedLayout.CurrentIndex
getset

This property holds the index position of the widget that is visible.

The current index is -1 if there is no current widget.

new QWidget QtGui.QStackedLayout.CurrentWidget
getset

Returns the current widget, or 0 if there are no widgets in this layout.

Sets the current widget to be the specified widget. The new current widget must already be contained in this stacked layout.

new IQStackedLayoutSignals QtGui.QStackedLayout.Emit
getprotected
override QRect QtGui.QStackedLayout.Geometry
getset

Reimplemented from QLayoutItem::setGeometry().

new StackingMode QtGui.QStackedLayout.stackingMode
getset

This property determines the way visibility of child widgets are handled.

The default value is StackOne. Setting the property to StackAll allows you to make use of the layout for overlay widgets that do additional drawing on top of other widgets, for example, graphical editors.

This property was introduced in Qt 4.4.

new QMetaObject QtGui.QStackedLayout.StaticMetaObject
staticget
Slot<System.Int32> QtGui.QStackedLayout.WidgetRemoved
addremove

This signal is emitted whenever a widget is removed from the layout. The widget's index is passed as parameter.

See also removeWidget().