CopperSpice API  1.8.1
QMdiArea Class Reference

The QMdiArea widget provides an area in which MDI windows are displayed. More...

Inheritance diagram for QMdiArea:
QAbstractScrollArea QFrame QWidget QObject QPaintDevice

Public Typedefs

using AreaOptions = QFlags< AreaOption >
- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >

Public Types

enum  AreaOption
enum  ViewMode
enum  WindowOrder
- Public Types inherited from QFrame
enum  Shadow
enum  Shape
enum  StyleMask
- Public Types inherited from QWidget
enum  RenderFlag
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric

Public Signals

void subWindowActivated (QMdiSubWindow *window)
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
void windowIconChanged (const QIcon &icon)
void windowIconTextChanged (const QString &iconText)
void windowTitleChanged (const QString &title)
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
void objectNameChanged (const QString &objectName)

Public Slots

void activateNextSubWindow ()
void activatePreviousSubWindow ()
void cascadeSubWindows ()
void closeActiveSubWindow ()
void closeAllSubWindows ()
void setActiveSubWindow (QMdiSubWindow *window)
void tileSubWindows ()
- Public Slots inherited from QWidget
bool close ()
void hide ()
void lower ()
void raise ()
void repaint ()
void setDisabled (bool disable)
void setEnabled (bool enable)
void setFocus ()
void setHidden (bool hidden)
void setStyleSheet (const QString &styleSheet)
virtual void setVisible (bool visible)
void setWindowModified (bool modified)
void setWindowTitle (const QString &title)
void show ()
void showFullScreen ()
void showMaximized ()
void showMinimized ()
void showNormal ()
void update ()
- Public Slots inherited from QObject
void deleteLater ()

Public Methods

 QMdiArea (QWidget *parent=nullptr)
 ~QMdiArea ()
WindowOrder activationOrder () const
QMdiSubWindowactiveSubWindow () const
QMdiSubWindowaddSubWindow (QWidget *widget, Qt::WindowFlags flags=Qt::EmptyFlag)
QBrush background () const
QMdiSubWindowcurrentSubWindow () const
bool documentMode () const
QSize minimumSizeHint () const override
void removeSubWindow (QWidget *widget)
void setActivationOrder (WindowOrder order)
void setBackground (const QBrush &background)
void setDocumentMode (bool enable)
void setOption (AreaOption option, bool on=true)
void setTabPosition (QTabWidget::TabPosition position)
void setTabsClosable (bool closeable)
void setTabShape (QTabWidget::TabShape shape)
void setTabsMovable (bool movable)
void setViewMode (ViewMode mode)
QSize sizeHint () const override
QList< QMdiSubWindow * > subWindowList (WindowOrder order=CreationOrder) const
QTabWidget::TabPosition tabPosition () const
bool tabsClosable () const
QTabWidget::TabShape tabShape () const
bool tabsMovable () const
bool testOption (AreaOption option) const
ViewMode viewMode () const
- Public Methods inherited from QAbstractScrollArea
 QAbstractScrollArea (QWidget *parent=nullptr)
 ~QAbstractScrollArea ()
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
QWidgetcornerWidget () const
QScrollBarhorizontalScrollBar () const
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
QSize maximumViewportSize () const
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
void setCornerWidget (QWidget *widget)
void setHorizontalScrollBar (QScrollBar *scrollBar)
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy policy)
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
virtual void setupViewport (QWidget *viewport)
void setVerticalScrollBar (QScrollBar *scrollBar)
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy policy)
void setViewport (QWidget *widget)
SizeAdjustPolicy sizeAdjustPolicy () const
QScrollBarverticalScrollBar () const
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
QWidgetviewport () const
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 ~QFrame ()
QRect frameRect () const
Shadow frameShadow () const
Shape frameShape () const
int frameStyle () const
int frameWidth () const
int lineWidth () const
int midLineWidth () const
void setFrameRect (const QRect &rect)
void setFrameShadow (Shadow value)
void setFrameShape (Shape value)
void setFrameStyle (int style)
void setLineWidth (int width)
void setMidLineWidth (int width)
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 ~QWidget ()
bool acceptDrops () const
QString accessibleDescription () const
QString accessibleName () const
QList< QAction * > actions () const
void activateWindow ()
void addAction (QAction *action)
void addActions (const QList< QAction * > &actions)
void adjustSize ()
bool autoFillBackground () const
QPalette::ColorRole backgroundRole () const
QBackingStorebackingStore () const
QSize baseSize () const
QWidget * childAt (const QPoint &position) const
QWidget * childAt (int x, int y) const
QRect childrenRect () const
QRegion childrenRegion () const
void clearFocus ()
void clearMask ()
QMargins contentsMargins () const
QRect contentsRect () const
Qt::ContextMenuPolicy contextMenuPolicy () const
QCursor cursor () const
WId effectiveWinId () const
void ensurePolished () const
Qt::FocusPolicy focusPolicy () const
QWidget * focusProxy () const
QWidget * focusWidget () const
const QFontfont () const
QFontInfo fontInfo () const
QFontMetrics fontMetrics () const
QPalette::ColorRole foregroundRole () const
QRect frameGeometry () const
QSize frameSize () const
const QRectgeometry () const
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
void grabKeyboard ()
void grabMouse ()
void grabMouse (const QCursor &cursor)
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
QGraphicsEffectgraphicsEffect () const
QGraphicsProxyWidgetgraphicsProxyWidget () const
bool hasEditFocus () const
bool hasFocus () const
virtual bool hasHeightForWidth () const
bool hasMouseTracking () const
int height () const
virtual int heightForWidth (int width) const
Qt::InputMethodHints inputMethodHints () const
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
void insertAction (QAction *before, QAction *action)
void insertActions (QAction *before, QList< QAction * > actions)
bool isActiveWindow () const
bool isAncestorOf (const QWidget *child) const
bool isEnabled () const
bool isEnabledTo (const QWidget *parent) const
bool isEnabledToTLW () const
bool isFullScreen () const
bool isHidden () const
bool isMaximized () const
bool isMinimized () const
bool isModal () const
bool isTopLevel () const
bool isVisible () const
bool isVisibleTo (const QWidget *parent) const
bool isWindow () const
bool isWindowModified () const
QLayoutlayout () const
Qt::LayoutDirection layoutDirection () const
QLocale locale () const
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
QPoint mapFromGlobal (const QPoint &pos) const
QPoint mapFromParent (const QPoint &pos) const
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
QPoint mapToGlobal (const QPoint &pos) const
QPoint mapToParent (const QPoint &pos) const
QRegion mask () const
int maximumHeight () const
QSize maximumSize () const
int maximumWidth () const
int minimumHeight () const
QSize minimumSize () const
int minimumWidth () const
void move (const QPoint &point)
void move (int x, int y)
QWidget * nativeParentWidget () const
QWidget * nextInFocusChain () const
QRect normalGeometry () const
void overrideWindowFlags (Qt::WindowFlags flags)
QPaintEnginepaintEngine () const override
const QPalettepalette () const
QWidget * parentWidget () const
QPoint pos () const
QWidget * previousInFocusChain () const
QRect rect () const
void releaseKeyboard ()
void releaseMouse ()
void releaseShortcut (int id)
void removeAction (QAction *action)
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
void repaint (const QRect &rect)
void repaint (const QRegion &region)
void repaint (int x, int y, int w, int h)
void resize (const QSize &size)
void resize (int w, int h)
bool restoreGeometry (const QByteArray &geometry)
QByteArray saveGeometry () const
void scroll (int dx, int dy)
void scroll (int dx, int dy, const QRect &rect)
void setAcceptDrops (bool on)
void setAccessibleDescription (const QString &description)
void setAccessibleName (const QString &name)
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
void setAutoFillBackground (bool enable)
void setBackgroundRole (QPalette::ColorRole role)
void setBaseSize (const QSize &size)
void setBaseSize (int basew, int baseh)
void setContentsMargins (const QMargins &margins)
void setContentsMargins (int left, int top, int right, int bottom)
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
void setCursor (const QCursor &cursor)
void setEditFocus (bool enable)
void setFixedHeight (int h)
void setFixedSize (const QSize &size)
void setFixedSize (int w, int h)
void setFixedWidth (int w)
void setFocus (Qt::FocusReason reason)
void setFocusPolicy (Qt::FocusPolicy policy)
void setFocusProxy (QWidget *widget)
void setFont (const QFont &font)
void setForegroundRole (QPalette::ColorRole role)
void setGeometry (const QRect &rect)
void setGeometry (int x, int y, int w, int h)
void setGraphicsEffect (QGraphicsEffect *effect)
void setInputMethodHints (Qt::InputMethodHints hints)
void setLayout (QLayout *layout)
void setLayoutDirection (Qt::LayoutDirection direction)
void setLocale (const QLocale &locale)
void setMask (const QBitmap &bitmap)
void setMask (const QRegion &region)
void setMaximumHeight (int maxh)
void setMaximumSize (const QSize &size)
void setMaximumSize (int maxw, int maxh)
void setMaximumWidth (int maxw)
void setMinimumHeight (int minh)
void setMinimumSize (const QSize &size)
void setMinimumSize (int minw, int minh)
void setMinimumWidth (int minw)
void setMouseTracking (bool enable)
void setPalette (const QPalette &palette)
void setParent (QWidget *parent)
void setParent (QWidget *parent, Qt::WindowFlags flags)
void setShortcutAutoRepeat (int id, bool enable=true)
void setShortcutEnabled (int id, bool enable=true)
void setSizeIncrement (const QSize &size)
void setSizeIncrement (int w, int h)
void setSizePolicy (QSizePolicy policy)
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
void setStatusTip (const QString &data)
void setStyle (QStyle *style)
void setToolTip (const QString &data)
void setToolTipDuration (int msec)
void setUpdatesEnabled (bool enable)
void setWhatsThis (const QString &str)
void setWindowFilePath (const QString &filePath)
void setWindowFlags (Qt::WindowFlags flags)
void setWindowIcon (const QIcon &icon)
void setWindowModality (Qt::WindowModality windowModality)
void setWindowOpacity (qreal level)
void setWindowRole (const QString &role)
void setWindowState (Qt::WindowStates windowState)
QSize size () const
QSize sizeIncrement () const
QSizePolicy sizePolicy () const
void stackUnder (QWidget *widget)
QString statusTip () const
QStylestyle () const
QString styleSheet () const
bool testAttribute (Qt::WidgetAttribute attribute) const
QString toolTip () const
int toolTipDuration () const
QWidget * topLevelWidget () const
bool underMouse () const
void ungrabGesture (Qt::GestureType gestureType)
void unsetCursor ()
void unsetLayoutDirection ()
void unsetLocale ()
void update (const QRect &rect)
void update (const QRegion &region)
void update (int x, int y, int w, int h)
void updateGeometry ()
bool updatesEnabled () const
QRegion visibleRegion () const
QString whatsThis () const
int width () const
QWidget * window () const
QString windowFilePath () const
Qt::WindowFlags windowFlags () const
QWindowwindowHandle () const
QIcon windowIcon () const
Qt::WindowModality windowModality () const
qreal windowOpacity () const
QString windowRole () const
Qt::WindowStates windowState () const
QString windowTitle () const
Qt::WindowType windowType () const
WId winId () const
int x () const
int y () const
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 ~QObject ()
bool blockSignals (bool block)
const QList< QObject * > & children () const
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QStringdynamicPropertyNames () const
virtual bool event (QEvent *event)
virtual bool eventFilter (QObject *watched, QEvent *event)
template<typename T >
findChild (const QString &childName=QString ()) const
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
bool inherits (const QString &className) const
void installEventFilter (QObject *filterObj)
bool isWidgetType () const
bool isWindowType () const
void killTimer (int id)
const QMetaObjectmetaObject () const
void moveToThread (QThread *targetThread)
QString objectName () const
QObject * parent () const
template<class T = QVariant>
property (const QString &name) const
void removeEventFilter (QObject *obj)
void setObjectName (const QString &name)
void setParent (QObject *parent)
bool setProperty (const QString &name, const QVariant &value)
bool signalsBlocked () const
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
QThreadthread () const
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
int colorCount () const
int depth () const
int devicePixelRatio () const
qreal devicePixelRatioF () const
int height () const
int heightMM () const
int logicalDpiX () const
int logicalDpiY () const
bool paintingActive () const
int physicalDpiX () const
int physicalDpiY () const
int width () const
int widthMM () const

Protected Slots

void setupViewport (QWidget *viewport)
- Protected Slots inherited from QWidget
void updateMicroFocus ()

Protected Methods

void childEvent (QChildEvent *childEvent) override
bool event (QEvent *event) override
bool eventFilter (QObject *object, QEvent *event) override
void paintEvent (QPaintEvent *paintEvent) override
void resizeEvent (QResizeEvent *resizeEvent) override
void scrollContentsBy (int dx, int dy) override
void showEvent (QShowEvent *showEvent) override
void timerEvent (QTimerEvent *timerEvent) override
bool viewportEvent (QEvent *event) override
- Protected Methods inherited from QAbstractScrollArea
void contextMenuEvent (QContextMenuEvent *event) override
void dragEnterEvent (QDragEnterEvent *event) override
void dragLeaveEvent (QDragLeaveEvent *event) override
void dragMoveEvent (QDragMoveEvent *event) override
void dropEvent (QDropEvent *event) override
bool event (QEvent *event) override
void keyPressEvent (QKeyEvent *event) override
void mouseDoubleClickEvent (QMouseEvent *event) override
void mouseMoveEvent (QMouseEvent *event) override
void mousePressEvent (QMouseEvent *event) override
void mouseReleaseEvent (QMouseEvent *event) override
void setViewportMargins (const QMargins &margins)
void setViewportMargins (int left, int top, int right, int bottom)
QMargins viewportMargins () const
virtual QSize viewportSizeHint () const
void wheelEvent (QWheelEvent *event) override
- Protected Methods inherited from QFrame
void changeEvent (QEvent *event) override
void drawFrame (QPainter *painter)
bool event (QEvent *event) override
void initStyleOption (QStyleOptionFrame *option) const
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
virtual void closeEvent (QCloseEvent *event)
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
virtual void enterEvent (QEvent *event)
bool event (QEvent *event) override
virtual void focusInEvent (QFocusEvent *event)
bool focusNextChild ()
virtual bool focusNextPrevChild (bool next)
virtual void focusOutEvent (QFocusEvent *event)
bool focusPreviousChild ()
virtual void hideEvent (QHideEvent *event)
void initPainter (QPainter *painter) const override
virtual void inputMethodEvent (QInputMethodEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual void leaveEvent (QEvent *event)
int metric (PaintDeviceMetric metric) const override
virtual void moveEvent (QMoveEvent *event)
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
virtual void tabletEvent (QTabletEvent *event)
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signalMethod) const
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
bool isSignalConnected (const QMetaMethod &signalMethod) const
int receivers (const QString &signal) const
QObject * sender () const
int senderSignalIndex () const
virtual void timerEvent (QTimerEvent *event)
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()


- Properties inherited from QAbstractScrollArea
- Properties inherited from QFrame
- Properties inherited from QWidget
- Properties inherited from QObject

Additional Inherited Members

- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
static QWidget * find (WId id)
static QWidget * keyboardGrabber ()
static QWidget * mouseGrabber ()
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
static QMetaObjectstaticMetaObject ()
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())

Detailed Description

The QMdiArea widget provides an area in which MDI windows are displayed. The class is like a window manager for MDI windows. For instance, it draws the windows it manages on itself and arranges them in a cascading or tile pattern. QMdiArea is commonly used as the center widget in a QMainWindow to create MDI applications, but can also be placed in any layout. The following code adds an area to a main window.

QMainWindow *mainWindow = new QMainWindow;

Unlike the window managers for top-level windows, all window flags (Qt::WindowFlags) are supported by QMdiArea as long as the flags are supported by the current widget style. If a specific flag is not supported by the style (e.g., the Qt::WindowShadeButtonHint), you can still shade the window with showShaded().

Subwindows in QMdiArea are instances of QMdiSubWindow and they are added to an MDI area with addSubWindow(). It is common to pass a QWidget to this method however it is also possible to pass a QMdiSubWindow directly. Since this class inherits from QWidget you can use the same API methods for a normal top level window. QMdiSubWindow also has behavior that is specific to MDI windows. See the QMdiSubWindow class description for more details.

A subwindow becomes active when it receives keyboard focus or when setFocus() is called. The MDI area emits the subWindowActivated() signal when the active window changes, and the activeSubWindow() method returns the active subwindow.

The method subWindowList() returns a list of all subwindows. This information could be used in a popup menu containing a list of windows, for example.

The subwindows are sorted by the current WindowOrder. This is used for the subWindowList() and for activateNextSubWindow() and activatePreviousSubWindow(). Also, it is used when cascading or tiling the windows with cascadeSubWindows() and tileSubWindows().

QMdiArea provides two built-in layout strategies for subwindows: cascadeSubWindows() and tileSubWindows(). Both are slots and are easily connected to menu entries.

The default scroll bar property for QMdiArea is Qt::ScrollBarAlwaysOff.
See also

Member Typedef Documentation

Typedef for QFlags<AreaOption>. Refer to QMdiArea::AreaOption for documentation.

Member Enumeration Documentation

This enum describes options that customize the behavior of the QMdiArea.

QMdiArea::DontMaximizeSubWindowOnActivation 0x1 When the active subwindow is maximized the default behavior is to maximize the next subwindow that is activated. Set this option if you do not want this behavior.
See also

This enum describes the view mode of the area. For example how a sub windows will be displayed.

QMdiArea::SubWindowView0 Display sub-windows with window frames (default).
QMdiArea::TabbedView1 Display sub-windows with tabs in a tab bar.
See also

Specifies the criteria to use for ordering the list of child windows returned by subWindowList(). The methods cascadeSubWindows() and tileSubWindows() follow this order when arranging the windows.

QMdiArea::CreationOrder0 Windows are returned in the order of their creation.
QMdiArea::StackingOrder1 Windows are returned in the order they are stacked, with the top-most window being last in the list.
QMdiArea::ActivationHistoryOrder2 Windows are returned in the order they were activated.
See also

Constructor & Destructor Documentation

QMdiArea::QMdiArea ( QWidget parent = nullptr)

Constructs an empty mdi area. The parent object is passed to the QWidget constructor.

QMdiArea::~QMdiArea ( )

Destroys the MDI area.

Method Documentation

void QMdiArea::activateNextSubWindow ( )

Gives the keyboard focus to another window in the list of child windows. The window activated will be the next one determined by the current activation order.

See also
activatePreviousSubWindow(), QMdiArea::WindowOrder
void QMdiArea::activatePreviousSubWindow ( )

Gives the keyboard focus to another window in the list of child windows. The window activated will be the previous one determined by the current activation order.

See also
activateNextSubWindow(), QMdiArea::WindowOrder
WindowOrder QMdiArea::activationOrder ( ) const

Returns the value of the property.

QMdiSubWindow * QMdiArea::activeSubWindow ( ) const

Returns a pointer to the current active subwindow. If no window is currently active, 0 is returned.

Subwindows are treated as top-level windows with respect to window state, i.e., if a widget outside the MDI area is the active window, no subwindow will be active. Note that if a widget in the window in which the MDI area lives gains focus, the window will be activated.

See also
setActiveSubWindow(), Qt::WindowState
QMdiSubWindow * QMdiArea::addSubWindow ( QWidget widget,
Qt::WindowFlags  flags = Qt::EmptyFlag 

Adds widget as a new subwindow to the MDI area. The widget can be either a QMdiSubWindow or another QWidget, in which case the MDI area will create a subwindow and set the widget as the internal widget. If flags is not a nullptr it will override the flags set on the widget. Returns the QMdiSubWindow that is added to the MDI area.

When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.

Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea.

QMdiArea mdiArea;
QMdiSubWindow *subWindow1 = new QMdiSubWindow;
QMdiSubWindow *subWindow2 = mdiArea.addSubWindow(internalWidget2);
See also
QBrush QMdiArea::background ( ) const

Returns the value of the property.

void QMdiArea::cascadeSubWindows ( )

Arranges all the child windows in a cascade pattern.

See also
void QMdiArea::childEvent ( QChildEvent childEvent)

Reimplemented from QObject::childEvent()

void QMdiArea::closeActiveSubWindow ( )

Closes the active subwindow.

See also
void QMdiArea::closeAllSubWindows ( )

Closes all subwindows by sending a QCloseEvent to each window. You may receive subWindowActivated() signals from subwindows before they are closed (if the MDI area activates the subwindow when another is closing).

Subwindows that ignore the close event will remain open.

See also
QMdiSubWindow * QMdiArea::currentSubWindow ( ) const

Returns a pointer to the current subwindow or a nullptr if there is no current subwindow. This method will return the same as activeSubWindow() if the QApplication containing QMdiArea is active.

See also
activeSubWindow(), QApplication::activeWindow()
bool QMdiArea::documentMode ( ) const

Returns the value of the property.

bool QMdiArea::event ( QEvent event)

Reimplemented from QWidget::event()

bool QMdiArea::eventFilter ( QObject object,
QEvent event 

Reimplemented from QWidget::eventFilter()

QSize QMdiArea::minimumSizeHint ( ) const
void QMdiArea::paintEvent ( QPaintEvent paintEvent)
void QMdiArea::removeSubWindow ( QWidget widget)

Removes widget from the MDI area. The widget must either be a QMdiSubWindow or a widget which is the internal widget of a subwindow. The widget is never actually deleted by QMdiArea. If the given widget is a QMdiSubWindow then its parent is set to a nullptr.

See also
void QMdiArea::resizeEvent ( QResizeEvent resizeEvent)
void QMdiArea::scrollContentsBy ( int  dx,
int  dy 
void QMdiArea::setActivationOrder ( WindowOrder  order)

Sets the value of the property to order.

void QMdiArea::setActiveSubWindow ( QMdiSubWindow window)

Activates the subwindow window. If window is a nullptr any current active window is deactivated.

See also
void QMdiArea::setBackground ( const QBrush background)

Sets the value of the property to background.

void QMdiArea::setDocumentMode ( bool  enable)

Sets the value of the property to enable.

void QMdiArea::setOption ( AreaOption  option,
bool  on = true 

If on true then option is enabled on the MDI area, otherwise it is disabled. Refer to AreaOption for the effect of each option.

See also
AreaOption, testOption()
void QMdiArea::setTabPosition ( QTabWidget::TabPosition  position)

Sets the value of the property to position.

void QMdiArea::setTabsClosable ( bool  closeable)

Sets the value of the property to closeable.

void QMdiArea::setTabShape ( QTabWidget::TabShape  shape)

Sets the value of the property to shape.

void QMdiArea::setTabsMovable ( bool  movable)

Sets the value of the property to moveable.

void QMdiArea::setupViewport ( QWidget viewport)

This slot is called by QAbstractScrollArea after setViewport() has been called. Reimplement this method in a subclass of QMdiArea to initialize the new viewport before it is used.

See also
void QMdiArea::setViewMode ( ViewMode  mode)

Sets the value of the property to mode.

void QMdiArea::showEvent ( QShowEvent showEvent)

Reimplemented from QWidget::showEvent()

QSize QMdiArea::sizeHint ( ) const

Reimplemented from QAbstractScrollArea::sizeHint()

void QMdiArea::subWindowActivated ( QMdiSubWindow window)

QMdiArea emits this signal after window has been activated. When window is 0, QMdiArea has just deactivated its last active window, and there are no active windows on the workspace.

See also
QList< QMdiSubWindow * > QMdiArea::subWindowList ( WindowOrder  order = CreationOrder) const

Returns a list of all subwindows in the MDI area. If order is CreationOrder (the default), the windows are sorted in the order in which they were inserted into the workspace. If order is StackingOrder, the windows are listed in their stacking order, with the topmost window as the last item in the list. If order is ActivationHistoryOrder, the windows are listed according to their recent activation history.

See also
QTabWidget::TabPosition QMdiArea::tabPosition ( ) const

Returns the value of the property.

bool QMdiArea::tabsClosable ( ) const

Returns the value of the property.

QTabWidget::TabShape QMdiArea::tabShape ( ) const

Returns the value of the property.

bool QMdiArea::tabsMovable ( ) const

Returns the value of the property.

bool QMdiArea::testOption ( AreaOption  option) const

Returns true if option is enabled, otherwise returns false.

See also
AreaOption, setOption()
void QMdiArea::tileSubWindows ( )

Arranges all child windows in a tile pattern.

See also
void QMdiArea::timerEvent ( QTimerEvent timerEvent)

Reimplemented from QObject::timerEvent()

ViewMode QMdiArea::viewMode ( ) const

Returns the value of the property.

bool QMdiArea::viewportEvent ( QEvent event)

Property Documentation


This property specifies the ordering criteria for the list of subwindows returned by subWindowList(). By default, it is the window creation order.

See also
PropertiesClass Methods
read activationOrder
write setActivationOrder

This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).

PropertiesClass Methods
read background
write setBackground

This property holds whether the tab bar is set to document mode in tabbed view mode. Document mode is disabled by default.

See also
QTabBar::documentMode, setViewMode()
PropertiesClass Methods
read documentMode
write setDocumentMode

This property holds the position of the tabs in tabbed view mode. Possible values for this property are described by the QTabWidget::TabPosition enum.

See also
QTabWidget::TabPosition, setViewMode()
PropertiesClass Methods
read tabPosition
write setTabPosition

This property holds whether the tab bar should place close buttons on each tab in tabbed view mode. Tabs are not closeable by default.

See also
QTabBar::tabsClosable, setViewMode()
PropertiesClass Methods
read tabsClosable
write setTabsClosable

This property holds the shape of the tabs in tabbed view mode. Possible values for this property are QTabWidget::Rounded (default) or QTabWidget::Triangular.

See also
QTabWidget::TabShape, setViewMode()
PropertiesClass Methods
read tabShape
write setTabShape

This property holds whether the user can move the tabs within the tabbar area in tabbed view mode. Tabs are not movable by default.

See also
QTabBar::movable, setViewMode()
PropertiesClass Methods
read tabsMovable
write setTabsMovable

This property holds the way sub-windows are displayed in the QMdiArea. By default, the SubWindowView is used to display sub-windows.

See also
ViewMode, setTabShape(), setTabPosition()
PropertiesClass Methods
read viewMode
write setViewMode