Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QStackedLayout Class Reference

The QStackedLayout class maintains a stack of widgets where only the top widget is visible. More...

#include <QStackedLayout>

Inherits QLayout.

Writable Properties

Read-Only Properties

Public Functions

Public Slots

Signals

Static Public Members

Protected Functions


Detailed Description

The QStackedLayout class maintains a stack of widgets where only the top widget is visible.

QStackedLayout places all the widgets it is responsible for on top of each other, so only the top one is visible to the user at any one time. Widget positions are given by positive integer indexes starting at 0; the widget on top has index position 0.

Widgets are added at the the end of the stack with addWidget(), or inserted in the stack with insertWidget(). The current widget is returned by currentWidget(), and its index is returned by currentIndex(). The index position of a given widget is returned by indexOf(), and the widget at a given index position by widget(). The number of widgets in the stack is returned by count(). The top widget is set with setCurrentIndex(). If a widget is removed (e.g. with QLayout::removeWidget()), the widgetRemoved() signal is emitted.

See also QStackedWidget.


Property Documentation

count : int

Access functions:

currentIndex : int

This property holds the index position of the current widget.

The current index is -1 if there is no current widget, for example if the stack is empty.

Access functions:

See also currentWidget() and indexOf().


Member Function Documentation

QStackedLayout::QStackedLayout ( QWidget * parent )

Constructs a new QStackedLayout with the given parent.

QStackedLayout::QStackedLayout ( QLayout * parentLayout )

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

QStackedLayout::~QStackedLayout ()

Destroys this QStackedLayout.

The layout's widgets are not destroyed.

int QStackedLayout::addWidget ( QWidget * w )

Adds widget w at the end of this layout stack and returns the index position of w.

The very first widget that is added becomes the initial current widget and is placed in index position 0 (i.e. on top).

See also insertWidget().

QWidget * QStackedLayout::currentWidget () const

Returns the current widget, or 0 if there are no widgets in this layout. Equivalent to widget(currentIndex()).

int QStackedLayout::indexOf ( QWidget * w ) const

Returns the index position of widget w in this layout, or -1 if w is not in this layout.

int QStackedLayout::insertWidget ( int index, QWidget * w )

Inserts widget w to this layout at position index. If index is out of range, the widget is appended. Returns the index position of w.

The very first widget that is added becomes the initial current widget and is placed in index position 0 (i.e. on top).

See also addWidget().

QWidget * QStackedLayout::widget ( int index ) const

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

void QStackedLayout::widgetRemoved ( int index )   [signal]

This signal is emitted if a widget is removed from the stack, e.g. with QLayout::removeWidget(). The position that the removed widget occupied in the stack is given by index.


Copyright © 2004 Trolltech Trademarks
Qt 4.0.0-b1