File indexing completed on 2026-09-23 09:24:07
0001
0002
0003
0004
0005 #ifndef QMDISUBWINDOW_H
0006 #define QMDISUBWINDOW_H
0007
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qwidget.h>
0010
0011 QT_REQUIRE_CONFIG(mdiarea);
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 class QMenu;
0016 class QMdiArea;
0017
0018 namespace QMdi { class ControlContainer; }
0019 class QMdiSubWindowPrivate;
0020 class Q_WIDGETS_EXPORT QMdiSubWindow : public QWidget
0021 {
0022 Q_OBJECT
0023 Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep)
0024 Q_PROPERTY(int keyboardPageStep READ keyboardPageStep WRITE setKeyboardPageStep)
0025 public:
0026 enum SubWindowOption {
0027 AllowOutsideAreaHorizontally = 0x1,
0028 AllowOutsideAreaVertically = 0x2,
0029 RubberBandResize = 0x4,
0030 RubberBandMove = 0x8
0031 };
0032 Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption)
0033
0034 QMdiSubWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0035 ~QMdiSubWindow();
0036
0037 QSize sizeHint() const override;
0038 QSize minimumSizeHint() const override;
0039
0040 void setWidget(QWidget *widget);
0041 QWidget *widget() const;
0042
0043 QWidget *maximizedButtonsWidget() const;
0044 QWidget *maximizedSystemMenuIconWidget() const;
0045
0046 bool isShaded() const;
0047
0048 void setOption(SubWindowOption option, bool on = true);
0049 bool testOption(SubWindowOption) const;
0050
0051 void setKeyboardSingleStep(int step);
0052 int keyboardSingleStep() const;
0053
0054 void setKeyboardPageStep(int step);
0055 int keyboardPageStep() const;
0056
0057 #if QT_CONFIG(menu)
0058 void setSystemMenu(QMenu *systemMenu);
0059 QMenu *systemMenu() const;
0060 #endif
0061
0062 QMdiArea *mdiArea() const;
0063
0064 Q_SIGNALS:
0065 void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
0066 void aboutToActivate();
0067
0068 public Q_SLOTS:
0069 #if QT_CONFIG(menu)
0070 void showSystemMenu();
0071 #endif
0072 void showShaded();
0073
0074 protected:
0075 bool eventFilter(QObject *object, QEvent *event) override;
0076 bool event(QEvent *event) override;
0077 void showEvent(QShowEvent *showEvent) override;
0078 void hideEvent(QHideEvent *hideEvent) override;
0079 void changeEvent(QEvent *changeEvent) override;
0080 void closeEvent(QCloseEvent *closeEvent) override;
0081 void leaveEvent(QEvent *leaveEvent) override;
0082 void resizeEvent(QResizeEvent *resizeEvent) override;
0083 void timerEvent(QTimerEvent *timerEvent) override;
0084 void moveEvent(QMoveEvent *moveEvent) override;
0085 void paintEvent(QPaintEvent *paintEvent) override;
0086 void mousePressEvent(QMouseEvent *mouseEvent) override;
0087 void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override;
0088 void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
0089 void mouseMoveEvent(QMouseEvent *mouseEvent) override;
0090 void keyPressEvent(QKeyEvent *keyEvent) override;
0091 #ifndef QT_NO_CONTEXTMENU
0092 void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
0093 #endif
0094 void focusInEvent(QFocusEvent *focusInEvent) override;
0095 void focusOutEvent(QFocusEvent *focusOutEvent) override;
0096 void childEvent(QChildEvent *childEvent) override;
0097
0098 private:
0099 Q_DISABLE_COPY(QMdiSubWindow)
0100 Q_DECLARE_PRIVATE(QMdiSubWindow)
0101 Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint())
0102 Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode())
0103 Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *))
0104 friend class QMdiAreaPrivate;
0105 friend class QMdiArea;
0106 #if QT_CONFIG(tabbar)
0107 friend class QMdiAreaTabBar;
0108 #endif
0109 friend class QMdi::ControlContainer;
0110 };
0111
0112 Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions)
0113
0114 QT_END_NAMESPACE
0115
0116 #endif