Warning, file /include/QtWidgets/qmainwindow.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QDYNAMICMAINWINDOW_H
0005 #define QDYNAMICMAINWINDOW_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qwidget.h>
0009 #if QT_CONFIG(tabwidget)
0010 #include <QtWidgets/qtabwidget.h>
0011 #endif
0012
0013 QT_REQUIRE_CONFIG(mainwindow);
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 class QDockWidget;
0018 class QMainWindowPrivate;
0019 class QMenuBar;
0020 class QStatusBar;
0021 class QToolBar;
0022 class QMenu;
0023
0024 class Q_WIDGETS_EXPORT QMainWindow : public QWidget
0025 {
0026 Q_OBJECT
0027
0028 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
0029 Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
0030 #if QT_CONFIG(dockwidget)
0031 Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated)
0032 #if QT_CONFIG(tabbar)
0033 Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
0034 #endif
0035 #if QT_CONFIG(tabwidget)
0036 Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape)
0037 #endif
0038 Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled)
0039 #endif
0040 Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions)
0041 #if QT_CONFIG(toolbar)
0042 Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac
0043 WRITE setUnifiedTitleAndToolBarOnMac)
0044 #endif
0045
0046 public:
0047 enum DockOption {
0048 AnimatedDocks = 0x01,
0049 AllowNestedDocks = 0x02,
0050 AllowTabbedDocks = 0x04,
0051 ForceTabbedDocks = 0x08,
0052 VerticalTabs = 0x10,
0053 GroupedDragging = 0x20
0054 };
0055 Q_ENUM(DockOption)
0056 Q_DECLARE_FLAGS(DockOptions, DockOption)
0057 Q_FLAG(DockOptions)
0058
0059 explicit QMainWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0060 ~QMainWindow();
0061
0062 QSize iconSize() const;
0063 void setIconSize(const QSize &iconSize);
0064
0065 Qt::ToolButtonStyle toolButtonStyle() const;
0066 void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle);
0067
0068 #if QT_CONFIG(dockwidget)
0069 bool isAnimated() const;
0070 bool isDockNestingEnabled() const;
0071 #endif
0072
0073 #if QT_CONFIG(tabbar)
0074 bool documentMode() const;
0075 void setDocumentMode(bool enabled);
0076 #endif
0077
0078 #if QT_CONFIG(tabwidget)
0079 QTabWidget::TabShape tabShape() const;
0080 void setTabShape(QTabWidget::TabShape tabShape);
0081 QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const;
0082 void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition);
0083 #endif
0084
0085 void setDockOptions(DockOptions options);
0086 DockOptions dockOptions() const;
0087
0088 bool isSeparator(const QPoint &pos) const;
0089
0090 #if QT_CONFIG(menubar)
0091 QMenuBar *menuBar() const;
0092 void setMenuBar(QMenuBar *menubar);
0093
0094 QWidget *menuWidget() const;
0095 void setMenuWidget(QWidget *menubar);
0096 #endif
0097
0098 #if QT_CONFIG(statusbar)
0099 QStatusBar *statusBar() const;
0100 void setStatusBar(QStatusBar *statusbar);
0101 #endif
0102
0103 QWidget *centralWidget() const;
0104 void setCentralWidget(QWidget *widget);
0105
0106 QWidget *takeCentralWidget();
0107
0108 #if QT_CONFIG(dockwidget)
0109 void setCorner(Qt::Corner corner, Qt::DockWidgetArea area);
0110 Qt::DockWidgetArea corner(Qt::Corner corner) const;
0111 #endif
0112
0113 #if QT_CONFIG(toolbar)
0114 void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea);
0115 void insertToolBarBreak(QToolBar *before);
0116
0117 void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar);
0118 void addToolBar(QToolBar *toolbar);
0119 QToolBar *addToolBar(const QString &title);
0120 void insertToolBar(QToolBar *before, QToolBar *toolbar);
0121 void removeToolBar(QToolBar *toolbar);
0122 void removeToolBarBreak(QToolBar *before);
0123
0124 bool unifiedTitleAndToolBarOnMac() const;
0125
0126 Qt::ToolBarArea toolBarArea(const QToolBar *toolbar) const;
0127 bool toolBarBreak(QToolBar *toolbar) const;
0128 #endif
0129
0130 #if QT_CONFIG(dockwidget)
0131 void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget);
0132 void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget,
0133 Qt::Orientation orientation);
0134 void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget,
0135 Qt::Orientation orientation);
0136 #if QT_CONFIG(tabbar)
0137 void tabifyDockWidget(QDockWidget *first, QDockWidget *second);
0138 QList<QDockWidget*> tabifiedDockWidgets(QDockWidget *dockwidget) const;
0139 #endif
0140 void removeDockWidget(QDockWidget *dockwidget);
0141 bool restoreDockWidget(QDockWidget *dockwidget);
0142
0143 Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const;
0144
0145 void resizeDocks(const QList<QDockWidget *> &docks,
0146 const QList<int> &sizes, Qt::Orientation orientation);
0147 #endif
0148
0149 QByteArray saveState(int version = 0) const;
0150 bool restoreState(const QByteArray &state, int version = 0);
0151
0152 #if QT_CONFIG(menu)
0153 virtual QMenu *createPopupMenu();
0154 #endif
0155
0156 public Q_SLOTS:
0157 #if QT_CONFIG(dockwidget)
0158 void setAnimated(bool enabled);
0159 void setDockNestingEnabled(bool enabled);
0160 #endif
0161 #if QT_CONFIG(toolbar)
0162 void setUnifiedTitleAndToolBarOnMac(bool set);
0163 #endif
0164
0165 Q_SIGNALS:
0166 void iconSizeChanged(const QSize &iconSize);
0167 void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
0168 #if QT_CONFIG(dockwidget)
0169 void tabifiedDockWidgetActivated(QDockWidget *dockWidget);
0170 #endif
0171
0172 protected:
0173 #ifndef QT_NO_CONTEXTMENU
0174 void contextMenuEvent(QContextMenuEvent *event) override;
0175 #endif
0176 bool event(QEvent *event) override;
0177
0178 private:
0179 Q_DECLARE_PRIVATE(QMainWindow)
0180 Q_DISABLE_COPY(QMainWindow)
0181 friend class QDockWidgetGroupWindow;
0182 };
0183
0184 Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
0185
0186 QT_END_NAMESPACE
0187
0188 #endif