File indexing completed on 2026-09-20 09:24:05
0001
0002
0003
0004
0005 #ifndef QSTACKEDWIDGET_H
0006 #define QSTACKEDWIDGET_H
0007
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qframe.h>
0010
0011 QT_REQUIRE_CONFIG(stackedwidget);
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 class QStackedWidgetPrivate;
0016
0017 class Q_WIDGETS_EXPORT QStackedWidget : public QFrame
0018 {
0019 Q_OBJECT
0020
0021 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
0022 Q_PROPERTY(int count READ count)
0023 public:
0024 explicit QStackedWidget(QWidget *parent = nullptr);
0025 ~QStackedWidget();
0026
0027 int addWidget(QWidget *w);
0028 int insertWidget(int index, QWidget *w);
0029 void removeWidget(QWidget *w);
0030
0031 QWidget *currentWidget() const;
0032 int currentIndex() const;
0033
0034 int indexOf(const QWidget *) const;
0035 QWidget *widget(int) const;
0036 int count() const;
0037
0038 public Q_SLOTS:
0039 void setCurrentIndex(int index);
0040 void setCurrentWidget(QWidget *w);
0041
0042 Q_SIGNALS:
0043 void currentChanged(int);
0044 void widgetRemoved(int index);
0045 void widgetAdded(int index);
0046
0047 protected:
0048 bool event(QEvent *e) override;
0049
0050 private:
0051 Q_DISABLE_COPY(QStackedWidget)
0052 Q_DECLARE_PRIVATE(QStackedWidget)
0053 };
0054
0055 QT_END_NAMESPACE
0056
0057 #endif