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