Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qstackedlayout.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSTACKEDLAYOUT_H
5#define QSTACKEDLAYOUT_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qlayout.h>
9
11
12
14
15class Q_WIDGETS_EXPORT QStackedLayout : public QLayout
16{
18 Q_DECLARE_PRIVATE(QStackedLayout)
19 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
20 Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode)
21 QDOC_PROPERTY(int count READ count)
22
23public:
26 StackAll
27 };
28 Q_ENUM(StackingMode)
29
31 explicit QStackedLayout(QWidget *parent);
32 explicit QStackedLayout(QLayout *parentLayout);
34
35 int addWidget(QWidget *w);
36 int insertWidget(int index, QWidget *w);
37
38 QWidget *currentWidget() const;
39 int currentIndex() const;
40 using QLayout::widget;
41 QWidget *widget(int) const;
42 int count() const override;
43
44 StackingMode stackingMode() const;
45 void setStackingMode(StackingMode stackingMode);
46
47 // abstract virtual functions:
48 void addItem(QLayoutItem *item) override;
49 QSize sizeHint() const override;
50 QSize minimumSize() const override;
51 QLayoutItem *itemAt(int) const override;
52 QLayoutItem *takeAt(int) override;
53 void setGeometry(const QRect &rect) override;
54 bool hasHeightForWidth() const override;
55 int heightForWidth(int width) const override;
56
60
61public Q_SLOTS:
62 void setCurrentIndex(int index);
63 void setCurrentWidget(QWidget *w);
64
65private:
66 Q_DISABLE_COPY(QStackedLayout)
67};
68
70
71#endif // QSTACKEDLAYOUT_H
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition qlayoutitem.h:25
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
virtual int heightForWidth(int) const
Returns the preferred height for this layout item, given the width, which is not used in this default...
virtual QWidget * widget() const
If this item manages a QWidget, returns that widget.
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
The QLayout class is the base class of geometry managers.
Definition qlayout.h:26
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition qlayout.cpp:186
virtual void addItem(QLayoutItem *)=0
Implemented in subclasses to add an item.
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
virtual QLayoutItem * takeAt(int index)=0
Must be implemented in subclasses to remove the layout item at index from the layout,...
QSize minimumSize() const override
Returns the minimum size of this layout.
Definition qlayout.cpp:911
virtual int count() const =0
Must be implemented in subclasses to return the number of items in the layout.
virtual void setGeometry(const QRect &) override
\reimp
Definition qlayout.cpp:451
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
The QStackedLayout class provides a stack of widgets where only one widget is visible at a time.
void widgetRemoved(int index)
This signal is emitted whenever a widget is removed from the layout.
void currentChanged(int index)
This signal is emitted whenever the current widget in the layout changes.
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
rect
[4]
Combined button and popup list for selecting options.
GLfloat GLfloat GLfloat w
[0]
GLuint index
[2]
GLenum GLenum GLsizei count
GLint GLsizei width
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define QDOC_PROPERTY(text)
#define Q_SIGNALS
QGraphicsItem * item
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent