Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmdiarea.h
Go to the documentation of this file.
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 QMDIAREA_H
5#define QMDIAREA_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractscrollarea.h>
9#if QT_CONFIG(tabwidget)
10#include <QtWidgets/qtabwidget.h>
11#endif
12
14
16
17class QMdiSubWindow;
18
19class QMdiAreaPrivate;
20class Q_WIDGETS_EXPORT QMdiArea : public QAbstractScrollArea
21{
23 Q_PROPERTY(QBrush background READ background WRITE setBackground)
24 Q_PROPERTY(WindowOrder activationOrder READ activationOrder WRITE setActivationOrder)
25 Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode)
26#if QT_CONFIG(tabbar)
27 Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
28 Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable)
29 Q_PROPERTY(bool tabsMovable READ tabsMovable WRITE setTabsMovable)
30#endif
31#if QT_CONFIG(tabwidget)
32 Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape)
33 Q_PROPERTY(QTabWidget::TabPosition tabPosition READ tabPosition WRITE setTabPosition)
34#endif
35public:
37 DontMaximizeSubWindowOnActivation = 0x1
38 };
39 Q_DECLARE_FLAGS(AreaOptions, AreaOption)
40
44 ActivationHistoryOrder
45 };
46 Q_ENUM(WindowOrder)
47
48 enum ViewMode {
50 TabbedView
51 };
52 Q_ENUM(ViewMode)
53
54 QMdiArea(QWidget *parent = nullptr);
55 ~QMdiArea();
56
57 QSize sizeHint() const override;
58 QSize minimumSizeHint() const override;
59
60 QMdiSubWindow *currentSubWindow() const;
61 QMdiSubWindow *activeSubWindow() const;
62 QList<QMdiSubWindow *> subWindowList(WindowOrder order = CreationOrder) const;
63
64 QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags flags = Qt::WindowFlags());
65 void removeSubWindow(QWidget *widget);
66
67 QBrush background() const;
68 void setBackground(const QBrush &background);
69
70 WindowOrder activationOrder() const;
71 void setActivationOrder(WindowOrder order);
72
73 void setOption(AreaOption option, bool on = true);
74 bool testOption(AreaOption opton) const;
75
76 void setViewMode(ViewMode mode);
77 ViewMode viewMode() const;
78
79#if QT_CONFIG(tabbar)
80 bool documentMode() const;
81 void setDocumentMode(bool enabled);
82
83 void setTabsClosable(bool closable);
84 bool tabsClosable() const;
85
86 void setTabsMovable(bool movable);
87 bool tabsMovable() const;
88#endif
89#if QT_CONFIG(tabwidget)
90 void setTabShape(QTabWidget::TabShape shape);
91 QTabWidget::TabShape tabShape() const;
92
93 void setTabPosition(QTabWidget::TabPosition position);
94 QTabWidget::TabPosition tabPosition() const;
95#endif
96
99
100public Q_SLOTS:
101 void setActiveSubWindow(QMdiSubWindow *window);
102 void tileSubWindows();
103 void cascadeSubWindows();
104 void closeActiveSubWindow();
105 void closeAllSubWindows();
106 void activateNextSubWindow();
107 void activatePreviousSubWindow();
108
109protected Q_SLOTS:
110 void setupViewport(QWidget *viewport) override;
111
112protected:
113 bool event(QEvent *event) override;
114 bool eventFilter(QObject *object, QEvent *event) override;
115 void paintEvent(QPaintEvent *paintEvent) override;
116 void childEvent(QChildEvent *childEvent) override;
117 void resizeEvent(QResizeEvent *resizeEvent) override;
118 void timerEvent(QTimerEvent *timerEvent) override;
119 void showEvent(QShowEvent *showEvent) override;
120 bool viewportEvent(QEvent *event) override;
121 void scrollContentsBy(int dx, int dy) override;
122
123private:
124 Q_DISABLE_COPY(QMdiArea)
125 Q_DECLARE_PRIVATE(QMdiArea)
126 Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows())
127 Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates))
128 Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int))
129 Q_PRIVATE_SLOT(d_func(), void _q_closeTab(int))
130 Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int, int))
131};
132
134
136
137#endif // QMDIAREA_H
\inmodule QtGui
Definition qbrush.h:30
\inmodule QtCore
Definition qcoreevent.h:379
\inmodule QtCore
Definition qcoreevent.h:45
The QMdiArea widget provides an area in which MDI windows are displayed.
Definition qmdiarea.h:21
WindowOrder
Specifies the criteria to use for ordering the list of child windows returned by subWindowList().
Definition qmdiarea.h:41
@ StackingOrder
Definition qmdiarea.h:43
@ CreationOrder
Definition qmdiarea.h:42
void subWindowActivated(QMdiSubWindow *)
QMdiArea emits this signal after window has been activated.
@ SubWindowView
Definition qmdiarea.h:49
AreaOption
This enum describes options that customize the behavior of the QMdiArea.
Definition qmdiarea.h:36
The QMdiSubWindow class provides a subwindow class for QMdiArea.
\inmodule QtCore
Definition qobject.h:103
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\inmodule QtCore
Definition qsize.h:25
TabPosition
This enum type defines where QTabWidget draws the tab row:
Definition qtabwidget.h:74
TabShape
This enum type defines the shape of the tabs: \value Rounded The tabs are drawn with a rounded look.
Definition qtabwidget.h:85
\inmodule QtCore
Definition qcoreevent.h:366
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
Combined button and popup list for selecting options.
Definition qcompare.h:63
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLenum mode
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLbitfield flags
struct _cl_event * event
GLuint GLenum option
GLfixed GLfixed GLint GLint order
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
dialog setViewMode(QFileDialog::Detail)
[3]
view viewport() -> scroll(dx, dy, deviceRect)
aWidget window() -> setWindowTitle("New Window Title")
[2]