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 QSTACKEDWIDGET_H |
5 | #define QSTACKEDWIDGET_H |
6 | |
7 | #include <QtWidgets/qtwidgetsglobal.h> |
8 | #include <QtWidgets/qframe.h> |
9 | |
10 | QT_REQUIRE_CONFIG(stackedwidget); |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QStackedWidgetPrivate; |
15 | |
16 | class Q_WIDGETS_EXPORT QStackedWidget : public QFrame |
17 | { |
18 | Q_OBJECT |
19 | |
20 | Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) |
21 | Q_PROPERTY(int count READ count) |
22 | public: |
23 | explicit QStackedWidget(QWidget *parent = nullptr); |
24 | ~QStackedWidget(); |
25 | |
26 | int addWidget(QWidget *w); |
27 | int insertWidget(int index, QWidget *w); |
28 | void removeWidget(QWidget *w); |
29 | |
30 | QWidget *currentWidget() const; |
31 | int currentIndex() const; |
32 | |
33 | int indexOf(const QWidget *) const; |
34 | QWidget *widget(int) const; |
35 | int count() const; |
36 | |
37 | public Q_SLOTS: |
38 | void setCurrentIndex(int index); |
39 | void setCurrentWidget(QWidget *w); |
40 | |
41 | Q_SIGNALS: |
42 | void currentChanged(int); |
43 | void widgetRemoved(int index); |
44 | |
45 | protected: |
46 | bool event(QEvent *e) override; |
47 | |
48 | private: |
49 | Q_DISABLE_COPY(QStackedWidget) |
50 | Q_DECLARE_PRIVATE(QStackedWidget) |
51 | }; |
52 | |
53 | QT_END_NAMESPACE |
54 | |
55 | #endif // QSTACKEDWIDGET_H |
56 | |