The QStackedLayout class provides a stack of widgets where only one widget is visible at a time.
More...
|
| QStackedLayout () |
|
| QStackedLayout (QLayout *parentLayout) |
|
| QStackedLayout (QWidget *parent) |
|
| ~QStackedLayout () |
|
void | addItem (QLayoutItem *item) override |
|
int | addWidget (QWidget *widget) |
|
int | count () const override |
|
int | currentIndex () const |
|
QWidget * | currentWidget () const |
|
bool | hasHeightForWidth () const override |
|
int | heightForWidth (int width) const override |
|
int | insertWidget (int index, QWidget *widget) |
|
QLayoutItem * | itemAt (int index) const override |
|
QSize | minimumSize () const override |
|
void | setGeometry (const QRect &rect) override |
|
void | setStackingMode (StackingMode stackingMode) |
|
QSize | sizeHint () const override |
|
StackingMode | stackingMode () const |
|
QLayoutItem * | takeAt (int index) override |
|
QWidget * | widget (int index) const |
|
| QLayout () |
|
| QLayout (QWidget *parent) |
|
bool | activate () |
|
void | addWidget (QWidget *w) |
|
QMargins | contentsMargins () const |
|
QRect | contentsRect () const |
|
QSizePolicy::ControlTypes | controlTypes () const override |
|
Qt::Orientations | expandingDirections () const override |
|
QRect | geometry () const override |
|
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
|
virtual int | indexOf (QWidget *widget) const |
|
void | invalidate () override |
|
bool | isEmpty () const override |
|
bool | isEnabled () const |
|
QLayout * | layout () override |
|
int | margin () const |
|
QSize | maximumSize () const override |
|
QWidget * | menuBar () const |
|
QWidget * | parentWidget () const |
|
void | removeItem (QLayoutItem *item) |
|
void | removeWidget (QWidget *widget) |
|
virtual QLayoutItem * | replaceWidget (QWidget *from, QWidget *to, Qt::FindChildOptions options=Qt::FindChildrenRecursively) |
|
bool | setAlignment (QLayout *layout, Qt::Alignment alignment) |
|
void | setAlignment (Qt::Alignment alignment) |
|
bool | setAlignment (QWidget *widget, Qt::Alignment alignment) |
|
void | setContentsMargins (const QMargins &margins) |
|
void | setContentsMargins (int left, int top, int right, int bottom) |
|
void | setEnabled (bool enable) |
|
void | setMargin (int margin) |
|
void | setMenuBar (QWidget *widget) |
|
void | setSizeConstraint (SizeConstraint constraint) |
|
void | setSpacing (int spacing) |
|
SizeConstraint | sizeConstraint () const |
|
int | spacing () const |
|
void | update () |
|
| QObject (QObject *parent=nullptr) |
|
| ~QObject () |
|
bool | blockSignals (bool block) |
|
const QList< QObject * > & | children () const |
|
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
|
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
|
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
|
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
|
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () |
|
QList< QString > | dynamicPropertyNames () const |
|
virtual bool | event (QEvent *event) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
template<typename T > |
T | findChild (const QString &childName=QString ()) const |
|
template<class T > |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
|
template<class T > |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
|
bool | inherits (const QString &className) const |
|
void | installEventFilter (QObject *filterObj) |
|
bool | isWidgetType () const |
|
bool | isWindowType () const |
|
void | killTimer (int id) |
|
const QMetaObject * | metaObject () const |
|
void | moveToThread (QThread *targetThread) |
|
QString | objectName () const |
|
QObject * | parent () const |
|
template<class T = QVariant> |
T | property (const QString &name) const |
|
void | removeEventFilter (QObject *obj) |
|
void | setObjectName (const QString &name) |
|
void | setParent (QObject *parent) |
|
bool | setProperty (const QString &name, const QVariant &value) |
|
bool | signalsBlocked () const |
|
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
|
QThread * | thread () const |
|
| QLayoutItem (Qt::Alignment alignment=Qt::Alignment ()) |
|
virtual | ~QLayoutItem () |
|
Qt::Alignment | alignment () const |
|
virtual int | minimumHeightForWidth (int width) const |
|
void | setAlignment (Qt::Alignment alignment) |
|
virtual QSpacerItem * | spacerItem () |
|
virtual QWidget * | widget () |
|
|
static QSize | closestAcceptableSize (const QWidget *widget, const QSize &size) |
|
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
|
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
|
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
|
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
|
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
|
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
|
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
|
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
|
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
|
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
|
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
|
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
|
static QMetaObject & | staticMetaObject () |
|
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
|
void | addChildLayout (QLayout *layout) |
|
void | addChildWidget (QWidget *widget) |
|
QRect | alignmentRect (const QRect &rect) const |
|
void | childEvent (QChildEvent *event) override |
|
virtual void | childEvent (QChildEvent *event) |
|
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
|
virtual void | customEvent (QEvent *event) |
|
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
|
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
|
int | receivers (const QString &signal) const |
|
QObject * | sender () const |
|
int | senderSignalIndex () const |
|
virtual void | timerEvent (QTimerEvent *event) |
|
T | qobject_cast (QObject *object) |
|
| QObjectList |
|
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").
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.
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, QTabWidget