OSDN Git Service

drop MDI support
authorIvailo Monev <xakepa10@gmail.com>
Fri, 11 Aug 2023 10:46:50 +0000 (13:46 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 11 Aug 2023 11:02:20 +0000 (14:02 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
30 files changed:
package/freebsd/pkg-plist
scripts/namefsck.py
src/core/global/qconfig.h.cmake
src/core/global/qnamespace.qdoc
src/gui/CMakeLists.txt
src/gui/graphicsview/qgraphicswidget.cpp
src/gui/styles/qcleanlooksstyle.cpp
src/gui/styles/qcommonstyle.cpp
src/gui/styles/qstyle.cpp
src/gui/styles/qstyle.h
src/gui/styles/qstyleoption.cpp
src/gui/styles/qstylesheetstyle.cpp
src/gui/widgets/qmainwindow.cpp
src/gui/widgets/qmdiarea.cpp [deleted file]
src/gui/widgets/qmdiarea.h [deleted file]
src/gui/widgets/qmdiarea_p.h [deleted file]
src/gui/widgets/qmdisubwindow.cpp [deleted file]
src/gui/widgets/qmdisubwindow.h [deleted file]
src/gui/widgets/qmdisubwindow_p.h [deleted file]
src/tools/qtconfig/previewframe.cpp
src/tools/qtconfig/previewframe.h
src/tools/uic/cpp/cppwriteincludes.cpp
src/tools/uic/cpp/cppwriteinitialization.cpp
src/tools/uic/uic.cpp
src/uitools/abstractformbuilder.cpp
src/uitools/formbuilder.cpp
src/uitools/widgets.table
tests/auto/qstyle/tst_qstyle.cpp
translations/qt.pot
translations/qt_tools.pot

index 39488b6..02a6e29 100644 (file)
@@ -495,8 +495,6 @@ include/katie/QtGui/QMatrix3x4
 include/katie/QtGui/QMatrix4x2
 include/katie/QtGui/QMatrix4x3
 include/katie/QtGui/QMatrix4x4
-include/katie/QtGui/QMdiArea
-include/katie/QtGui/QMdiSubWindow
 include/katie/QtGui/QMenu
 include/katie/QtGui/QMenuBar
 include/katie/QtGui/QMessageBox
@@ -783,8 +781,6 @@ include/katie/QtGui/qlistwidget.h
 include/katie/QtGui/qmainwindow.h
 include/katie/QtGui/qmatrix.h
 include/katie/QtGui/qmatrix4x4.h
-include/katie/QtGui/qmdiarea.h
-include/katie/QtGui/qmdisubwindow.h
 include/katie/QtGui/qmenu.h
 include/katie/QtGui/qmenubar.h
 include/katie/QtGui/qmessagebox.h
index c168565..4746a61 100755 (executable)
@@ -291,8 +291,6 @@ classlist = [
     "QMatrix4x2",
     "QMatrix4x3",
     "QMatrix4x4",
-    "QMdiArea",
-    "QMdiSubWindow",
     "QMenu",
     "QMenuBar",
     "QMessageBox",
index 52ac17b..b67b27a 100644 (file)
 // #cmakedefine QT_NO_MAINWINDOW
 // #cmakedefine QT_NO_MATRIX4X4
 // #cmakedefine QT_NO_VECTOR3D
-// #cmakedefine QT_NO_MDIAREA
 // #cmakedefine QT_NO_MENU
 // #cmakedefine QT_NO_MENUBAR
 // #cmakedefine QT_NO_MESSAGEBOX
 #  define QT_NO_GRAPHICSVIEW
 #endif
 
-// QMdiArea
-#if !defined(QT_NO_MDIAREA) && defined(QT_NO_SCROLLAREA)
-#  define QT_NO_MDIAREA
-#endif
-
 // QPrinter
 #if !defined(QT_NO_PRINTER) && defined(QT_NO_TEMPORARYFILE)
 #  define QT_NO_PRINTER
index f3a6dab..86357ba 100644 (file)
     \value Desktop  Indicates that this widget is the desktop. This
                     is the type for QDesktopWidget.
 
-    \value SubWindow  Indicates that this widget is a sub-window, such
-                      as a QMdiSubWindow widget.
+    \value SubWindow  Indicates that this widget is a sub-window.
 
     There are also a number of flags which you can use to customize
     the appearance of top-level windows. These have no effect on other
index 0e3c368..e1ae55f 100644 (file)
@@ -102,8 +102,6 @@ set(GUI_PUBLIC_HEADERS
     QMainWindow
     QMatrix
     QMatrix4x4
-    QMdiArea
-    QMdiSubWindow
     QMenu
     QMenuBar
     QMovie
@@ -522,10 +520,6 @@ set(GUI_HEADERS
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qlinecontrol_p.h
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmainwindow.h
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmainwindowlayout_p.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdiarea.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdiarea_p.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdisubwindow.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdisubwindow_p.h
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmenu.h
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmenu_p.h
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmenubar.h
@@ -813,8 +807,6 @@ set(GUI_SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qlinecontrol.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmainwindow.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmainwindowlayout.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdiarea.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmdisubwindow.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmenu.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qmenubar.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/widgets/qprogressbar.cpp
index 68215d8..76d627c 100644 (file)
@@ -47,6 +47,9 @@
 
 #include "qdebug.h"
 
+        
+static const int qSubWindowFrameWidth = 4;
+
 QT_BEGIN_NAMESPACE
 
 /*!
@@ -570,8 +573,7 @@ void QGraphicsWidget::unsetWindowFrameMargins()
          (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) {
         QStyleOptionTitleBar bar;
         d->initStyleOptionTitleBar(&bar);
-        QStyle *style = this->style();
-        qreal margin = style->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
+        qreal margin = qSubWindowFrameWidth;
         qreal titleBarHeight  = d->titleBarHeight(bar);
         setWindowFrameMargins(margin, titleBarHeight, margin, margin);
     } else {
@@ -2228,7 +2230,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap
     QStyleHintReturnMask mask;
     bool setMask = style()->styleHint(QStyle::SH_WindowFrame_Mask, &bar, widget, &mask) && !mask.region.isEmpty();
     bool hasBorder = !style()->styleHint(QStyle::SH_TitleBar_NoBorder, &bar, widget);
-    int frameWidth = style()->pixelMetric(QStyle::PM_MDIFrameWidth, &bar, widget);
+    int frameWidth = qSubWindowFrameWidth;
     if (setMask) {
         painter->save();
         painter->setClipRegion(mask.region, Qt::IntersectClip);
@@ -2280,7 +2282,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap
 
     frameOptions.palette.setCurrentColorGroup(isActive ? QPalette::Active : QPalette::Normal);
     frameOptions.rect = windowFrameRect;
-    frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, widget);
+    frameOptions.lineWidth = qSubWindowFrameWidth;
     frameOptions.midLineWidth = 1;
     style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget);
 }
index 9c61fff..c5c97e6 100644 (file)
@@ -3501,20 +3501,6 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
     case CT_SizeGrip:
         newSize += QSize(4, 4);
         break;
-    case CT_MdiControls:
-        if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
-            int width = 0;
-            if (styleOpt->subControls & SC_MdiMinButton)
-                width += 19 + 1;
-            if (styleOpt->subControls & SC_MdiNormalButton)
-                width += 19 + 1;
-            if (styleOpt->subControls & SC_MdiCloseButton)
-                width += 19 + 1;
-            newSize = QSize(width, 19);
-        } else {
-            newSize = QSize(60, 19);
-        }
-        break;
     default:
         break;
     }
index 36de260..5843719 100644 (file)
@@ -3521,68 +3521,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
         }
         break;
 #endif // QT_NO_GROUPBOX
-#ifndef QT_NO_MDIAREA
-    case CC_MdiControls:
-        {
-            QStyleOptionButton btnOpt;
-            btnOpt.QStyleOption::operator=(*opt);
-            btnOpt.state &= ~State_MouseOver;
-            int bsx = 0;
-            int bsy = 0;
-            if (opt->subControls & QStyle::SC_MdiCloseButton) {
-                if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
-                    btnOpt.state |= State_Sunken;
-                    btnOpt.state &= ~State_Raised;
-                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
-                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
-                } else {
-                    btnOpt.state |= State_Raised;
-                    btnOpt.state &= ~State_Sunken;
-                    bsx = 0;
-                    bsy = 0;
-                }
-                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
-                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
-                QPixmap pm = standardIcon(SP_TitleBarCloseButton).pixmap(16, 16);
-                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
-            }
-            if (opt->subControls & QStyle::SC_MdiNormalButton) {
-                if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
-                    btnOpt.state |= State_Sunken;
-                    btnOpt.state &= ~State_Raised;
-                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
-                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
-                } else {
-                    btnOpt.state |= State_Raised;
-                    btnOpt.state &= ~State_Sunken;
-                    bsx = 0;
-                    bsy = 0;
-                }
-                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
-                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
-                QPixmap pm = standardIcon(SP_TitleBarNormalButton).pixmap(16, 16);
-                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
-            }
-            if (opt->subControls & QStyle::SC_MdiMinButton) {
-                if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
-                    btnOpt.state |= State_Sunken;
-                    btnOpt.state &= ~State_Raised;
-                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
-                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
-                } else {
-                    btnOpt.state |= State_Raised;
-                    btnOpt.state &= ~State_Sunken;
-                    bsx = 0;
-                    bsy = 0;
-                }
-                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
-                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
-                QPixmap pm = standardIcon(SP_TitleBarMinButton).pixmap(16, 16);
-                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
-            }
-        }
-        break;
-#endif // QT_NO_MDIAREA
 
     default:
         qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc);
@@ -3706,20 +3644,6 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
         }
         break;
 #endif // QT_NO_GROUPBOX
-    case CC_MdiControls:
-        {
-            QRect r;
-            uint ctrl = SC_MdiMinButton;
-            while (ctrl <= SC_MdiCloseButton) {
-                r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget);
-                if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) {
-                    sc = QStyle::SubControl(ctrl);
-                    return sc;
-                }
-                ctrl <<= 1;
-            }
-        }
-        break;
     default:
         qWarning("QCommonStyle::hitTestComplexControl: Case %d not handled", cc);
     }
@@ -4109,49 +4033,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
         break;
     }
 #endif // QT_NO_GROUPBOX
-#ifndef QT_NO_MDIAREA
-    case CC_MdiControls: {
-        int numSubControls = 0;
-        if (opt->subControls & SC_MdiCloseButton)
-            ++numSubControls;
-        if (opt->subControls & SC_MdiMinButton)
-            ++numSubControls;
-        if (opt->subControls & SC_MdiNormalButton)
-            ++numSubControls;
-        if (numSubControls == 0)
-            break;
-
-        int buttonWidth = opt->rect.width()/ numSubControls - 1;
-        int offset = 0;
-        switch (sc) {
-        case SC_MdiCloseButton:
-            // Only one sub control, no offset needed.
-            if (numSubControls == 1)
-                break;
-            offset += buttonWidth + 2;
-            //FALL THROUGH
-        case SC_MdiNormalButton:
-            // No offset needed if
-            // 1) There's only one sub control
-            // 2) We have a close button and a normal button (offset already added in SC_MdiClose)
-            if (numSubControls == 1 || (numSubControls == 2 && !(opt->subControls & SC_MdiMinButton)))
-                break;
-            if (opt->subControls & SC_MdiNormalButton)
-                offset += buttonWidth;
-            break;
-        default:
-            break;
-        }
-
-        // Subtract one pixel if we only have one sub control. At this point
-        // buttonWidth is the actual width + 1 pixel margin, but we don't want the
-        // margin when there are no other controllers.
-        if (numSubControls == 1)
-            --buttonWidth;
-        ret = QRect(offset, 0, buttonWidth, opt->rect.height());
-        break;
-    }
-#endif // QT_NO_MDIAREA
      default:
         qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
     }
@@ -4232,14 +4113,6 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
         ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
         break;
 
-    case PM_MdiSubWindowFrameWidth:
-        ret = 4;
-        break;
-
-    case PM_MdiSubWindowMinimizedWidth:
-        ret = 196;
-        break;
-
 #ifndef QT_NO_SCROLLBAR
     case PM_ScrollBarExtent:
         if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -4605,20 +4478,6 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
             sz += QSize(!grb->isFlat() ? 16 : 0, 0);
         break;
 #endif // QT_NO_GROUPBOX
-    case CT_MdiControls:
-        if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
-            int width = 1;
-            if (styleOpt->subControls & SC_MdiMinButton)
-                width += 16 + 1;
-            if (styleOpt->subControls & SC_MdiNormalButton)
-                width += 16 + 1;
-            if (styleOpt->subControls & SC_MdiCloseButton)
-                width += 16 + 1;
-            sz = QSize(width, 16);
-        } else {
-            sz = QSize(52, 16);
-        }
-        break;
 #ifndef QT_NO_ITEMVIEWS
     case CT_ItemViewItem:
         if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
index ff29d71..ca96798 100644 (file)
@@ -1038,12 +1038,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
     \value CC_ScrollBar         A scroll bar, like QScrollBar.
     \value CC_Slider            A slider, like QSlider.
     \value CC_ToolButton        A tool button, like QToolButton.
-    \value CC_TitleBar          A Title bar, like those used in QMdiSubWindow.
+    \value CC_TitleBar          A Title bar, obsolete.
     \value CC_GroupBox          A group box, like QGroupBox.
     \value CC_Dial              A dial, like QDial.
-    \value CC_MdiControls       The minimize, close, and normal
-                                button in the menu bar for a
-                                maximized MDI subwindow.
 
     \value CC_CustomBase Base value for custom complex controls. Custom
     values must be greater than this value.
@@ -1109,13 +1106,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
     \value SC_GroupBoxCheckBox The optional check box of a group box.
     \value SC_GroupBoxContents The group box contents.
 
-    \value SC_MdiNormalButton The normal button for a MDI
-                              subwindow in the menu bar.
-    \value SC_MdiMinButton The minimize button for a MDI
-                           subwindow in the menu bar.
-    \value SC_MdiCloseButton The close button for a MDI subwindow
-                             in the menu bar.
-
     \value SC_All  Special value that matches all sub-controls.
     \omitvalue SC_CustomBase
 
@@ -1251,11 +1241,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
     \value PM_SpinBoxFrameWidth  Frame width of a spin box, defaults to PM_DefaultFrameWidth.
     \value PM_ComboBoxFrameWidth Frame width of a combo box, defaults to PM_DefaultFrameWidth.
 
-    \value PM_MDIFrameWidth  Obsolete. Use PM_MdiSubWindowFrameWidth instead.
-    \value PM_MdiSubWindowFrameWidth  Frame width of an MDI window.
-    \value PM_MDIMinimizedWidth  Obsolete. Use PM_MdiSubWindowMinimizedWidth instead.
-    \value PM_MdiSubWindowMinimizedWidth  Width of a minimized MDI window.
-
     \value PM_LayoutLeftMargin  Default \l{QLayout::setContentsMargins()}{left margin} for a
                                 QLayout.
     \value PM_LayoutTopMargin  Default \l{QLayout::setContentsMargins()}{top margin} for a QLayout.
@@ -1462,10 +1447,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
     \value CT_CustomBase  Base value for custom contents types.
     Custom values must be greater than this value.
 
-    \value CT_MdiControls The minimize, normal, and close button
-                          in the menu bar for a maximized MDI
-                          subwindow.
-
     \sa sizeFromContents()
 */
 
@@ -1822,8 +1803,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
     This enum describes the available standard pixmaps. A standard pixmap is a pixmap that
     can follow some existing GUI style or guideline.
 
-    \value SP_TitleBarMinButton  Minimize button on title bars (e.g.,
-        in QMdiSubWindow).
+    \value SP_TitleBarMinButton  Minimize button on title bars.
     \value SP_TitleBarMenuButton Menu button on a title bar.
     \value SP_TitleBarMaxButton  Maximize button on title bars.
     \value SP_TitleBarCloseButton  Close button on title bars.
index d93b8ff..80f7c72 100644 (file)
@@ -337,7 +337,6 @@ public:
         CC_TitleBar,
         CC_Dial,
         CC_GroupBox,
-        CC_MdiControls,
 
         // do not add any values below/greater than this
         CC_CustomBase = 0xf0000000
@@ -391,10 +390,6 @@ public:
         SC_GroupBoxContents =      0x00000004,
         SC_GroupBoxFrame =         0x00000008,
 
-        SC_MdiMinButton     =      0x00000001,
-        SC_MdiNormalButton  =      0x00000002,
-        SC_MdiCloseButton   =      0x00000004,
-
         SC_CustomBase =            0xf0000000,
         SC_All =                   0xffffffff
     };
@@ -466,11 +461,6 @@ public:
         PM_DialogButtonsButtonWidth,
         PM_DialogButtonsButtonHeight,
 
-        PM_MdiSubWindowFrameWidth,
-        PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth,            //obsolete
-        PM_MdiSubWindowMinimizedWidth,
-        PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth,    //obsolete
-
         PM_HeaderMargin,
         PM_HeaderMarkSize,
         PM_HeaderGripMargin,
@@ -556,7 +546,6 @@ public:
         CT_DialogButtons,
         CT_HeaderSection,
         CT_GroupBox,
-        CT_MdiControls,
         CT_ItemViewItem,
         // do not add any values below/greater than this
         CT_CustomBase = 0xf0000000
index 8781e2f..e3a3c94 100644 (file)
@@ -2784,7 +2784,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
     parameters for drawing a title bar.
 
     QStyleOptionTitleBar contains all the information that QStyle
-    functions need to draw the title bar of a QMdiSubWindow.
+    functions need to draw the title bar.
 
     For performance reasons, the access to the member variables is
     direct (i.e., using the \c . or \c -> operator). This low-level feel
@@ -2794,7 +2794,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
     For an example demonstrating how style options can be used, see
     the \l {widgets/styles}{Styles} example.
 
-    \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
+    \sa QStyleOption, QStyleOptionComplex
 */
 
 /*!
index 8f5e428..475a0a2 100644 (file)
@@ -54,7 +54,6 @@
 #include "qmetaobject.h"
 #include "qmainwindow.h"
 #include "qdockwidget.h"
-#include "qmdisubwindow.h"
 #include "qdialog.h"
 #include "qabstractspinbox.h"
 #include "qlabel.h"
@@ -169,9 +168,6 @@ enum PseudoElement {
     PseudoElement_DockWidgetCloseButton,
     PseudoElement_DockWidgetFloatButton,
     PseudoElement_DockWidgetSeparator,
-    PseudoElement_MdiCloseButton,
-    PseudoElement_MdiMinButton,
-    PseudoElement_MdiNormalButton,
     PseudoElement_TitleBar,
     PseudoElement_TitleBarCloseButton,
     PseudoElement_TitleBarMinButton,
@@ -258,9 +254,6 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
     { QStyle::SC_None, QLatin1String("close-button") },
     { QStyle::SC_None, QLatin1String("float-button") },
     { QStyle::SC_None, QLatin1String("separator") },
-    { QStyle::SC_MdiCloseButton, QLatin1String("close-button") },
-    { QStyle::SC_MdiMinButton, QLatin1String("minimize-button") },
-    { QStyle::SC_MdiNormalButton, QLatin1String("normal-button") },
     { QStyle::SC_TitleBarLabel, QLatin1String("title") },
     { QStyle::SC_TitleBarCloseButton, QLatin1String("close-button") },
     { QStyle::SC_TitleBarMinButton, QLatin1String("minimize-button") },
@@ -670,18 +663,15 @@ static QList<QVariant> subControlLayout(const QString& layout)
         int button = layout[i].toAscii();
         switch (button) {
         case 'm':
-            buttons.append(PseudoElement_MdiMinButton);
             buttons.append(PseudoElement_TitleBarMinButton);
             break;
         case 'M':
             buttons.append(PseudoElement_TitleBarMaxButton);
             break;
         case 'X':
-            buttons.append(PseudoElement_MdiCloseButton);
             buttons.append(PseudoElement_TitleBarCloseButton);
             break;
         case 'N':
-            buttons.append(PseudoElement_MdiNormalButton);
             buttons.append(PseudoElement_TitleBarNormalButton);
             break;
         case 'I':
@@ -819,9 +809,6 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget
 static QStyle::StandardPixmap subControlIcon(int pe)
 {
     switch (pe) {
-    case PseudoElement_MdiCloseButton: return QStyle::SP_TitleBarCloseButton;
-    case PseudoElement_MdiMinButton: return QStyle::SP_TitleBarMinButton;
-    case PseudoElement_MdiNormalButton: return QStyle::SP_TitleBarNormalButton;
     case PseudoElement_TitleBarCloseButton: return QStyle::SP_TitleBarCloseButton;
     case PseudoElement_TitleBarMinButton: return QStyle::SP_TitleBarMinButton;
     case PseudoElement_TitleBarMaxButton: return QStyle::SP_TitleBarMaxButton;
@@ -2693,9 +2680,6 @@ void QStyleSheetStyle::polish(QWidget *w)
 #ifndef QT_NO_MAINWINDOW
               || qobject_cast<QMainWindow *>(w)
 #endif
-#ifndef QT_NO_MDIAREA
-              || qobject_cast<QMdiSubWindow *>(w)
-#endif
 #ifndef QT_NO_MENUBAR
               || qobject_cast<QMenuBar *>(w)
 #endif
@@ -3133,39 +3117,6 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
         break;
 #endif // QT_NO_SLIDER
 
-    case CC_MdiControls:
-        if (hasStyleRule(w, PseudoElement_MdiCloseButton)
-            || hasStyleRule(w, PseudoElement_MdiNormalButton)
-            || hasStyleRule(w, PseudoElement_MdiMinButton)) {
-            QList<QVariant> layout = subControlLayout(QLatin1String("mNX"));
-
-            QStyleOptionComplex optCopy(*opt);
-            optCopy.subControls = 0;
-            for (int i = 0; i < layout.count(); i++) {
-                int layoutButton = layout[i].toInt();
-                if (layoutButton < PseudoElement_MdiCloseButton
-                    || layoutButton > PseudoElement_MdiNormalButton)
-                    continue;
-                QStyle::SubControl control = knownPseudoElements[layoutButton].subControl;
-                if (!(opt->subControls & control))
-                    continue;
-                QRenderRule subRule = renderRule(w, opt, layoutButton);
-                if (subRule.hasDrawable()) {
-                    QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin);
-                    subRule.drawRule(p, rect);
-                    QIcon icon = standardIcon(subControlIcon(layoutButton), opt);
-                    icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter);
-                } else {
-                    optCopy.subControls |= control;
-                }
-            }
-
-            if (optCopy.subControls)
-                baseStyle()->drawComplexControl(CC_MdiControls, &optCopy, p, w);
-            return;
-        }
-        break;
-
     case CC_TitleBar:
         if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
             QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);
@@ -4456,14 +4407,6 @@ QStyle::SubControl QStyleSheetStyle::hitTestComplexControl(ComplexControl cc, co
         break;
     }
 
-    case CC_MdiControls: {
-        if (hasStyleRule(w, PseudoElement_MdiCloseButton)
-            || hasStyleRule(w, PseudoElement_MdiNormalButton)
-            || hasStyleRule(w, PseudoElement_MdiMinButton))
-            return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w);
-        break;
-    }
-
     case CC_ScrollBar: {
         QRenderRule rule = renderRule(w, opt);
         if (!rule.hasDrawable() && !rule.hasBox())
@@ -4777,21 +4720,6 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
         break;
     }
 
-    case PM_MdiSubWindowFrameWidth: {
-        if (rule.hasBox() || rule.hasBorder()) {
-            return (rule.border() ? rule.border()->borders[LeftEdge] : 0)
-                   + (rule.hasBox() ? rule.box()->paddings[LeftEdge]+rule.box()->margins[LeftEdge]: 0);
-        }
-        break;
-    }
-
-    case PM_MdiSubWindowMinimizedWidth: {
-        QRenderRule subRule = renderRule(w, PseudoElement_None, PseudoClass_Minimized);
-        int width = subRule.size().width();
-        if (width != -1)
-            return width;
-        break;
-    }
     default:
         break;
     }
@@ -4962,35 +4890,6 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
     }
 #endif // QT_NO_TABBAR
 
-    case CT_MdiControls: {
-        if (const QStyleOptionComplex *ccOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
-            if (!hasStyleRule(w, PseudoElement_MdiCloseButton)
-                && !hasStyleRule(w, PseudoElement_MdiNormalButton)
-                && !hasStyleRule(w, PseudoElement_MdiMinButton))
-                break;
-
-            QList<QVariant> layout = subControlLayout(QLatin1String("mNX"));
-
-            int width = 0, height = 0;
-            for (int i = 0; i < layout.count(); i++) {
-                int layoutButton = layout[i].toInt();
-                if (layoutButton < PseudoElement_MdiCloseButton
-                    || layoutButton > PseudoElement_MdiNormalButton)
-                    continue;
-                QStyle::SubControl sc = knownPseudoElements[layoutButton].subControl;
-                if (!(ccOpt->subControls & sc))
-                    continue;
-                QRenderRule subRule = renderRule(w, opt, layoutButton);
-                QSize sz = subRule.size();
-                width += sz.width();
-                height = qMax(height, sz.height());
-            }
-
-            return QSize(width, height);
-        }
-        break;
-    }
-
 #ifndef QT_NO_ITEMVIEWS
     case CT_ItemViewItem: {
         QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);
@@ -5520,33 +5419,6 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
         break;
 #endif // QT_NO_SLIDER
 
-    case CC_MdiControls:
-        if (hasStyleRule(w, PseudoElement_MdiCloseButton)
-            || hasStyleRule(w, PseudoElement_MdiNormalButton)
-            || hasStyleRule(w, PseudoElement_MdiMinButton)) {
-            QList<QVariant> layout = subControlLayout(QLatin1String("mNX"));
-
-            int x = 0, width = 0;
-            QRenderRule subRule;
-            for (int i = 0; i < layout.count(); i++) {
-                int layoutButton = layout[i].toInt();
-                if (layoutButton < PseudoElement_MdiCloseButton
-                    || layoutButton > PseudoElement_MdiNormalButton)
-                    continue;
-                QStyle::SubControl control = knownPseudoElements[layoutButton].subControl;
-                if (!(opt->subControls & control))
-                    continue;
-                subRule = renderRule(w, opt, layoutButton);
-                width = subRule.size().width();
-                if (sc == control)
-                    break;
-                x += width;
-            }
-
-            return subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height()));
-        }
-        break;
-
     case CC_TitleBar:
         if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
             QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar);
index d13ca0c..a5ca43a 100644 (file)
@@ -151,10 +151,6 @@ void QMainWindowPrivate::init()
     used for advanced applications. You set the central widget with \c
     setCentralWidget().
 
-    Main windows have either a single (SDI) or multiple (MDI)
-    document interface. You create MDI applications in Qt by using a
-    QMdiArea as the central widget.
-
     We will now examine each of the other widgets that can be
     added to a main window. We give examples on how to create and add
     them.
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
deleted file mode 100644 (file)
index fae002a..0000000
+++ /dev/null
@@ -1,2625 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-    \class QMdiArea
-    \brief The QMdiArea widget provides an area in which MDI windows are displayed.
-    \since 4.3
-    \ingroup mainwindow-classes
-
-
-    QMdiArea functions, essentially, 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:
-
-    \snippet doc/src/snippets/mdiareasnippets.cpp 0
-
-    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
-    \l{Qt::}{WindowShadeButtonHint}), you can still shade the window
-    with showShaded().
-
-    Subwindows in QMdiArea are instances of QMdiSubWindow. They
-    are added to an MDI area with addSubWindow(). It is common to pass
-    a QWidget, which is set as the internal widget, to this function,
-    but it is also possible to pass a QMdiSubWindow directly.The class
-    inherits QWidget, and you can use the same API as with a normal
-    top-level window when programming. QMdiSubWindow also has behavior
-    that is specific to MDI windows. See the QMdiSubWindow class
-    description for more details.
-
-    A subwindow becomes active when it gets the keyboard focus, or
-    when setFocus() is called. The user activates a window by moving
-    focus in the usual ways. The MDI area emits the
-    subWindowActivated() signal when the active window changes, and
-    the activeSubWindow() function returns the active subwindow.
-
-    The convenience function 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
-    \l{QMdiArea::}{WindowOrder}. This is used for the subWindowList()
-    and for activateNextSubWindow() and acivatePreviousSubWindow().
-    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.
-
-    \table
-    \row \o \inlineimage mdi-cascade.png
-         \o \inlineimage mdi-tile.png
-    \endtable
-
-    \note The default scroll bar property for QMdiArea is Qt::ScrollBarAlwaysOff.
-
-    \sa QMdiSubWindow
-*/
-
-/*!
-    \fn QMdiArea::subWindowActivated(QMdiSubWindow *window)
-
-    QMdiArea emits this signal after \a window has been activated. When \a
-    window is 0, QMdiArea has just deactivated its last active window, and
-    there are no active windows on the workspace.
-
-    \sa QMdiArea::activeSubWindow()
-*/
-
-/*!
-    \enum QMdiArea::AreaOption
-
-    This enum describes options that customize the behavior of the
-    QMdiArea.
-
-    \value DontMaximizeSubWindowOnActivation 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.
-*/
-
-/*!
-    \enum QMdiArea::WindowOrder
-
-    Specifies the criteria to use for ordering the list of child windows
-    returned by subWindowList(). The functions cascadeSubWindows() and
-    tileSubWindows() follow this order when arranging the windows.
-
-    \value CreationOrder The windows are returned in the order of
-    their creation.
-
-    \value StackingOrder The windows are returned in the order in
-    which they are stacked, with the top-most window being last in
-    the list.
-
-    \value ActivationHistoryOrder The windows are returned in the order in
-    which they were activated.
-
-    \sa subWindowList()
-*/
-
-/*!
-    \enum QMdiArea::ViewMode
-    \since 4.4
-
-    This enum describes the view mode of the area; i.e. how sub-windows
-    will be displayed.
-
-    \value SubWindowView Display sub-windows with window frames (default).
-    \value TabbedView Display sub-windows with tabs in a tab bar.
-
-    \sa setViewMode()
-*/
-
-#include "qmdiarea_p.h"
-
-#ifndef QT_NO_MDIAREA
-
-#include <QApplication>
-#include <QStyle>
-#include <QEvent>
-#include <QScrollBar>
-#include "qalgorithms.h"
-#include <QList>
-#include <QPainter>
-#include <QFontMetrics>
-#include <QStyleOption>
-#include <QDesktopWidget>
-#include <QDebug>
-#include "qmath.h"
-#include "qlayoutengine_p.h"
-#include "qguicommon_p.h"
-
-QT_BEGIN_NAMESPACE
-
-using namespace QMdi;
-
-// Asserts in debug mode, gives warning otherwise.
-static bool sanityCheck(const QMdiSubWindow * const child, const char *where)
-{
-    if (!child) {
-        static const char error[] = "null pointer";
-        Q_ASSERT_X(false, where, error);
-        qWarning("%s:%s", where, error);
-        return false;
-    }
-    return true;
-}
-
-static bool sanityCheck(const QList<QWidget *> &widgets, const int index, const char *where)
-{
-    if (index < 0 || index >= widgets.size()) {
-        static const char error[] = "index out of range";
-        Q_ASSERT_X(false, where, error);
-        qWarning("%s:%s", where, error);
-        return false;
-    }
-    if (!widgets.at(index)) {
-        static const char error[] = "null pointer";
-        Q_ASSERT_X(false, where, error);
-        qWarning("%s:%s", where, error);
-        return false;
-    }
-    return true;
-}
-
-static void setIndex(int *index, int candidate, int min, int max, bool isIncreasing)
-{
-    if (!index)
-        return;
-
-    if (isIncreasing) {
-        if (candidate > max)
-            *index = min;
-        else
-            *index = qMax(candidate, min);
-    } else {
-        if (candidate < min)
-            *index = max;
-        else
-            *index = qMin(candidate, max);
-    }
-    Q_ASSERT(*index >= min && *index <= max);
-}
-
-static inline bool useScrollBar(const QRect &childrenRect, const QSize &maxViewportSize,
-                                Qt::Orientation orientation)
-{
-    if (orientation == Qt::Horizontal)
-        return  childrenRect.width() > maxViewportSize.width()
-                || childrenRect.left() < 0
-                || childrenRect.right() >= maxViewportSize.width();
-    else
-        return childrenRect.height() > maxViewportSize.height()
-               || childrenRect.top() < 0
-               || childrenRect.bottom() >= maxViewportSize.height();
-}
-
-// Returns the closest mdi area containing the widget (if any).
-static inline QMdiArea *mdiAreaParent(QWidget *widget)
-{
-    if (!widget)
-        return 0;
-
-    QWidget *parent = widget->parentWidget();
-    while (parent) {
-        if (QMdiArea *area = qobject_cast<QMdiArea *>(parent))
-            return area;
-        parent = parent->parentWidget();
-    }
-    return 0;
-}
-
-static inline QString tabTextFor(QMdiSubWindow *subWindow)
-{
-    if (!subWindow)
-        return QString();
-
-    QString title = subWindow->windowTitle();
-    if (subWindow->isWindowModified()) {
-        title.replace(QLatin1String("[*]"), QLatin1String("*"));
-    } else {
-        extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*);
-        title = qt_setWindowTitle_helperHelper(title, subWindow);
-    }
-
-    return title.isEmpty() ? QMdiArea::tr("(Untitled)") : title;
-}
-
-/*!
-    \internal
-*/
-void RegularTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const
-{
-    if (widgets.isEmpty())
-        return;
-
-    const int n = widgets.size();
-    const int ncols = qMax(qCeil(qSqrt(qreal(n))), 1);
-    const int nrows = qMax((n % ncols) ? (n / ncols + 1) : (n / ncols), 1);
-    const int nspecial = (n % ncols) ? (ncols - n % ncols) : 0;
-    const int dx = domain.width()  / ncols;
-    const int dy = domain.height() / nrows;
-
-    int i = 0;
-    for (int row = 0; row < nrows; ++row) {
-        const int y1 = int(row * (dy + 1));
-        for (int col = 0; col < ncols; ++col) {
-            if (row == 1 && col < nspecial)
-                continue;
-            const int x1 = int(col * (dx + 1));
-            int x2 = int(x1 + dx);
-            int y2 = int(y1 + dy);
-            if (row == 0 && col < nspecial) {
-                y2 *= 2;
-                if (nrows != 2)
-                    y2 += 1;
-                else
-                    y2 = domain.bottom();
-            }
-            if (col == ncols - 1 && x2 != domain.right())
-                x2 = domain.right();
-            if (row == nrows - 1 && y2 != domain.bottom())
-                y2 = domain.bottom();
-            if (!sanityCheck(widgets, i, "RegularTiler"))
-                continue;
-            QWidget *widget = widgets.at(i++);
-            QRect newGeometry = QRect(QPoint(x1, y1), QPoint(x2, y2));
-            widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));
-        }
-    }
-}
-
-/*!
-    \internal
-*/
-void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) const
-{
-    if (widgets.isEmpty())
-        return;
-
-    // Tunables:
-    const int topOffset = 0;
-    const int bottomOffset = 50;
-    const int leftOffset = 0;
-    const int rightOffset = 100;
-    const int dx = 10;
-
-    QStyleOptionTitleBar options;
-    options.initFrom(widgets.at(0));
-    const int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
-    const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QWorkspaceTitleBar"));
-    const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
-
-    const int n = widgets.size();
-    const int nrows = qMax((domain.height() - (topOffset + bottomOffset)) / dy, 1);
-    const int ncols = qMax(n / nrows + ((n % nrows) ? 1 : 0), 1);
-    const int dcol = (domain.width() - (leftOffset + rightOffset)) / ncols;
-
-    int i = 0;
-    for (int row = 0; row < nrows; ++row) {
-        for (int col = 0; col < ncols; ++col) {
-            const int x = leftOffset + row * dx + col * dcol;
-            const int y = topOffset + row * dy;
-            if (!sanityCheck(widgets, i, "SimpleCascader"))
-                continue;
-            QWidget *widget = widgets.at(i++);
-            QRect newGeometry = QRect(QPoint(x, y), widget->sizeHint());
-            widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));
-            if (i == n)
-                return;
-        }
-    }
-}
-
-/*!
-    \internal
-*/
-void IconTiler::rearrange(QList<QWidget *> &widgets, const QRect &domain) const
-{
-    if (widgets.isEmpty() || !sanityCheck(widgets, 0, "IconTiler"))
-        return;
-
-    const int n = widgets.size();
-    const int width = widgets.at(0)->width();
-    const int height = widgets.at(0)->height();
-    const int ncols = qMax(domain.width() / width, 1);
-    const int nrows = n / ncols + ((n % ncols) ? 1 : 0);
-
-    int i = 0;
-    for (int row = 0; row < nrows; ++row) {
-        for (int col = 0; col < ncols; ++col) {
-            const int x = col * width;
-            const int y = domain.height() - height - row * height;
-            if (!sanityCheck(widgets, i, "IconTiler"))
-                continue;
-            QWidget *widget = widgets.at(i++);
-            QPoint newPos(x, y);
-            QRect newGeometry = QRect(newPos.x(), newPos.y(), widget->width(), widget->height());
-            widget->setGeometry(QStyle::visualRect(widget->layoutDirection(), domain, newGeometry));
-            if (i == n)
-                return;
-        }
-    }
-}
-
-/*!
-    \internal
-    Calculates the accumulated overlap (intersection area) between 'source' and 'rects'.
-*/
-int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QList<QRect> &rects)
-{
-    int accOverlap = 0;
-    foreach (const QRect &rect, rects) {
-        QRect intersection = source.intersected(rect);
-        accOverlap += intersection.width() * intersection.height();
-    }
-    return accOverlap;
-}
-
-
-/*!
-    \internal
-    Finds among 'source' the rectangle with the minimum accumulated overlap with the
-    rectangles in 'rects'.
-*/
-QRect MinOverlapPlacer::findMinOverlapRect(const QList<QRect> &source, const QList<QRect> &rects)
-{
-    int minAccOverlap = -1;
-    QRect minAccOverlapRect;
-    foreach (const QRect &srcRect, source) {
-        const int accOverlap = accumulatedOverlap(srcRect, rects);
-        if (accOverlap < minAccOverlap || minAccOverlap == -1) {
-            minAccOverlap = accOverlap;
-            minAccOverlapRect = srcRect;
-        }
-    }
-    return minAccOverlapRect;
-}
-
-/*!
-    \internal
-    Gets candidates for the final placement.
-*/
-void MinOverlapPlacer::getCandidatePlacements(const QSize &size, const QList<QRect> &rects,
-                                              const QRect &domain,QList<QRect> &candidates)
-{
-    QSet<int> xset;
-    QSet<int> yset;
-    xset << domain.left() << domain.right() - size.width() + 1;
-    yset << domain.top();
-    if (domain.bottom() - size.height() + 1 >= 0)
-        yset << domain.bottom() - size.height() + 1;
-    foreach (const QRect &rect, rects) {
-        xset << rect.right() + 1;
-        yset << rect.bottom() + 1;
-    }
-
-    QList<int> xlist = xset.values();
-    qSort(xlist.begin(), xlist.end());
-    QList<int> ylist = yset.values();
-    qSort(ylist.begin(), ylist.end());
-
-    foreach (int y, ylist)
-        foreach (int x, xlist)
-            candidates << QRect(QPoint(x, y), size);
-}
-
-/*!
-    \internal
-    Finds all rectangles in 'source' not completely inside 'domain'. The result is stored
-    in 'result' and also removed from 'source'.
-*/
-void MinOverlapPlacer::findNonInsiders(const QRect &domain, QList<QRect> &source,
-                                       QList<QRect> &result)
-{
-    QMutableListIterator<QRect> it(source);
-    while (it.hasNext()) {
-        const QRect srcRect = it.next();
-        if (!domain.contains(srcRect)) {
-            result << srcRect;
-            it.remove();
-        }
-    }
-}
-
-/*!
-   \internal
-    Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area
-    between 'domain' and any rectangle in 'source'. The result is stored in 'result'.
-*/
-void MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QList<QRect> &source,
-                                          QList<QRect> &result)
-{
-    int maxOverlap = -1;
-    foreach (const QRect &srcRect, source) {
-        QRect intersection = domain.intersected(srcRect);
-        const int overlap = intersection.width() * intersection.height();
-        if (overlap >= maxOverlap || maxOverlap == -1) {
-            if (overlap > maxOverlap) {
-                maxOverlap = overlap;
-                result.clear();
-            }
-            result << srcRect;
-        }
-    }
-}
-
-/*!
-   \internal
-    Finds among the rectangles in 'source' the best placement. Here, 'best' means the
-    placement that overlaps the rectangles in 'rects' as little as possible while at the
-    same time being as much as possible inside 'domain'.
-*/
-QPoint MinOverlapPlacer::findBestPlacement(const QRect &domain, const QList<QRect> &rects,
-                                           QList<QRect> &source)
-{
-    QList<QRect> nonInsiders;
-    findNonInsiders(domain, source, nonInsiders);
-
-    if (!source.empty())
-        return findMinOverlapRect(source, rects).topLeft();
-
-    QList<QRect> maxOverlappers;
-    findMaxOverlappers(domain, nonInsiders, maxOverlappers);
-    return findMinOverlapRect(maxOverlappers, rects).topLeft();
-}
-
-
-/*!
-    \internal
-    Places the rectangle defined by 'size' relative to 'rects' and 'domain' so that it
-    overlaps 'rects' as little as possible and 'domain' as much as possible.
-    Returns the position of the resulting rectangle.
-*/
-QPoint MinOverlapPlacer::place(const QSize &size, const QList<QRect> &rects,
-                               const QRect &domain) const
-{
-    if (size.isEmpty() || !domain.isValid())
-        return QPoint();
-    foreach (const QRect &rect, rects) {
-        if (!rect.isValid())
-            return QPoint();
-    }
-
-    QList<QRect> candidates;
-    getCandidatePlacements(size, rects, domain, candidates);
-    return findBestPlacement(domain, rects, candidates);
-}
-
-#ifndef QT_NO_TABBAR
-class QMdiAreaTabBar : public QTabBar
-{
-public:
-    QMdiAreaTabBar(QWidget *parent) : QTabBar(parent) {}
-
-protected:
-    void mousePressEvent(QMouseEvent *event);
-#ifndef QT_NO_CONTEXTMENU
-    void contextMenuEvent(QContextMenuEvent *event);
-#endif
-
-private:
-    QMdiSubWindow *subWindowFromIndex(int index) const;
-};
-
-/*!
-    \internal
-*/
-void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)
-{
-    if (event->button() != Qt::MiddleButton) {
-        QTabBar::mousePressEvent(event);
-        return;
-    }
-
-    QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->pos()));
-    if (!subWindow) {
-        event->ignore();
-        return;
-    }
-
-    subWindow->close();
-}
-
-#ifndef QT_NO_CONTEXTMENU
-/*!
-    \internal
-*/
-void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
-{
-    QPointer<QMdiSubWindow> subWindow = subWindowFromIndex(tabAt(event->pos()));
-    if (!subWindow || subWindow->isHidden()) {
-        event->ignore();
-        return;
-    }
-
-#ifndef QT_NO_MENU
-    QMdiSubWindowPrivate *subWindowPrivate = subWindow->d_func();
-    if (!subWindowPrivate->systemMenu) {
-        event->ignore();
-        return;
-    }
-
-    QMdiSubWindow *currentSubWindow = subWindowFromIndex(currentIndex());
-    Q_ASSERT(currentSubWindow);
-
-    // We don't want these actions to show up in the system menu when the
-    // current sub-window is maximized, i.e. covers the entire viewport.
-    if (currentSubWindow->isMaximized()) {
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::MoveAction, false);
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::ResizeAction, false);
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::MinimizeAction, false);
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::MaximizeAction, false);
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::RestoreAction, false);
-        subWindowPrivate->setVisible(QMdiSubWindowPrivate::StayOnTopAction, false);
-    }
-
-    // Show system menu.
-    subWindowPrivate->systemMenu->exec(event->globalPos());
-    if (!subWindow)
-        return;
-
-    // Restore action visibility.
-    subWindowPrivate->updateActions();
-#endif // QT_NO_MENU
-}
-#endif // QT_NO_CONTEXTMENU
-
-/*!
-    \internal
-*/
-QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const
-{
-    if (index < 0 || index >= count())
-        return 0;
-
-    QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parentWidget());
-    Q_ASSERT(mdiArea);
-
-    const QList<QMdiSubWindow *> subWindows = mdiArea->subWindowList();
-    Q_ASSERT(index < subWindows.size());
-
-    QMdiSubWindow *subWindow = mdiArea->subWindowList().at(index);
-    Q_ASSERT(subWindow);
-
-    return subWindow;
-}
-#endif // QT_NO_TABBAR
-
-/*!
-    \internal
-*/
-QMdiAreaPrivate::QMdiAreaPrivate()
-    : cascader(0),
-      regularTiler(0),
-      iconTiler(0),
-      placer(0),
-#ifndef QT_NO_RUBBERBAND
-      rubberBand(0),
-#endif
-#ifndef QT_NO_TABBAR
-      tabBar(0),
-#endif
-      activationOrder(QMdiArea::CreationOrder),
-      viewMode(QMdiArea::SubWindowView),
-#ifndef QT_NO_TABBAR
-      documentMode(false),
-      tabsClosable(false),
-      tabsMovable(false),
-#endif
-#ifndef QT_NO_TABWIDGET
-      tabShape(QTabWidget::Rounded),
-      tabPosition(QTabWidget::North),
-#endif
-      ignoreGeometryChange(false),
-      ignoreWindowStateChange(false),
-      isActivated(false),
-      isSubWindowsTiled(false),
-      showActiveWindowMaximized(false),
-      tileCalledFromResizeEvent(false),
-      updatesDisabledByUs(false),
-      inViewModeChange(false),
-      indexToNextWindow(-1),
-      indexToPreviousWindow(-1),
-      indexToHighlighted(-1),
-      indexToLastActiveTab(-1),
-      resizeTimerId(-1),
-      tabToPreviousTimerId(-1)
-{
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::_q_deactivateAllWindows(QMdiSubWindow *aboutToActivate)
-{
-    if (ignoreWindowStateChange)
-        return;
-
-    Q_Q(QMdiArea);
-    if (!aboutToActivate)
-        aboutToBecomeActive = qobject_cast<QMdiSubWindow *>(q->sender());
-    else
-        aboutToBecomeActive = aboutToActivate;
-    Q_ASSERT(aboutToBecomeActive);
-
-    foreach (QMdiSubWindow *child, childWindows) {
-        if (!sanityCheck(child, "QMdiArea::deactivateAllWindows") || aboutToBecomeActive == child)
-            continue;
-        // We don't want to handle signals caused by child->showNormal().
-        ignoreWindowStateChange = true;
-        if(!(options & QMdiArea::DontMaximizeSubWindowOnActivation) && !showActiveWindowMaximized)
-            showActiveWindowMaximized = child->isMaximized() && child->isVisible();
-        if (showActiveWindowMaximized && child->isMaximized()) {
-            if (q->updatesEnabled()) {
-                updatesDisabledByUs = true;
-                q->setUpdatesEnabled(false);
-            }
-            child->showNormal();
-        }
-        if (child->isMinimized() && !child->isShaded() && !windowStaysOnTop(child))
-            child->lower();
-        ignoreWindowStateChange = false;
-        child->d_func()->setActive(false);
-    }
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::_q_processWindowStateChanged(Qt::WindowStates oldState,
-                                                   Qt::WindowStates newState)
-{
-    if (ignoreWindowStateChange)
-        return;
-
-    Q_Q(QMdiArea);
-    QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(q->sender());
-    if (!child)
-        return;
-
-    // windowActivated
-    if (!(oldState & Qt::WindowActive) && (newState & Qt::WindowActive))
-        emitWindowActivated(child);
-    // windowDeactivated
-    else if ((oldState & Qt::WindowActive) && !(newState & Qt::WindowActive))
-        resetActiveWindow(child);
-
-    // windowMinimized
-    if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized)) {
-        isSubWindowsTiled = false;
-        arrangeMinimizedSubWindows();
-    // windowMaximized
-    } else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized)) {
-        internalRaise(child);
-    // windowRestored
-    } else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized))) {
-        internalRaise(child);
-        if (oldState & Qt::WindowMinimized)
-            arrangeMinimizedSubWindows();
-    }
-}
-
-void QMdiAreaPrivate::_q_currentTabChanged(int index)
-{
-#ifdef QT_NO_TABBAR
-    Q_UNUSED(index);
-#else
-    if (!tabBar || index < 0)
-        return;
-
-    // If the previous active sub-window was hidden, disable the tab.
-    if (indexToLastActiveTab >= 0 && indexToLastActiveTab < tabBar->count()
-        && indexToLastActiveTab < childWindows.count()) {
-        QMdiSubWindow *lastActive = childWindows.at(indexToLastActiveTab);
-        if (lastActive && lastActive->isHidden())
-            tabBar->setTabEnabled(indexToLastActiveTab, false);
-    }
-
-    indexToLastActiveTab = index;
-    Q_ASSERT(childWindows.size() > index);
-    QMdiSubWindow *subWindow = childWindows.at(index);
-    Q_ASSERT(subWindow);
-    activateWindow(subWindow);
-#endif // QT_NO_TABBAR
-}
-
-void QMdiAreaPrivate::_q_closeTab(int index)
-{
-#ifdef QT_NO_TABBAR
-    Q_UNUSED(index);
-#else
-    QMdiSubWindow *subWindow = childWindows.at(index);
-    Q_ASSERT(subWindow);
-    subWindow->close();
-#endif // QT_NO_TABBAR
-}
-
-void QMdiAreaPrivate::_q_moveTab(int from, int to)
-{
-#ifdef QT_NO_TABBAR
-    Q_UNUSED(from);
-    Q_UNUSED(to);
-#else
-    childWindows.move(from, to);
-#endif // QT_NO_TABBAR
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::appendChild(QMdiSubWindow *child)
-{
-    Q_Q(QMdiArea);
-    Q_ASSERT(child && childWindows.indexOf(child) == -1);
-
-    if (child->parent() != viewport)
-        child->setParent(viewport, child->windowFlags());
-    childWindows.append(QPointer<QMdiSubWindow>(child));
-
-    if (!child->testAttribute(Qt::WA_Resized) && q->isVisible()) {
-        QSize newSize(child->sizeHint().boundedTo(viewport->size()));
-        child->resize(newSize.expandedTo(qSmartMinSize(child)));
-    }
-
-    if (!placer)
-        placer = new MinOverlapPlacer;
-    place(placer, child);
-
-    if (hbarpolicy != Qt::ScrollBarAlwaysOff)
-        child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, true);
-    else
-        child->setOption(QMdiSubWindow::AllowOutsideAreaHorizontally, false);
-
-    if (vbarpolicy != Qt::ScrollBarAlwaysOff)
-        child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, true);
-    else
-        child->setOption(QMdiSubWindow::AllowOutsideAreaVertically, false);
-
-    internalRaise(child);
-    indicesToActivatedChildren.prepend(childWindows.size() - 1);
-    Q_ASSERT(indicesToActivatedChildren.size() == childWindows.size());
-
-#ifndef QT_NO_TABBAR
-    if (tabBar) {
-        tabBar->addTab(child->windowIcon(), tabTextFor(child));
-        updateTabBarGeometry();
-        if (childWindows.count() == 1 && !(options & QMdiArea::DontMaximizeSubWindowOnActivation))
-            showActiveWindowMaximized = true;
-    }
-#endif
-
-    if (!(child->windowFlags() & Qt::SubWindow))
-        child->setWindowFlags(Qt::SubWindow);
-    child->installEventFilter(q);
-
-    QObject::connect(child, SIGNAL(aboutToActivate()), q, SLOT(_q_deactivateAllWindows()));
-    QObject::connect(child, SIGNAL(windowStateChanged(Qt::WindowStates,Qt::WindowStates)),
-                     q, SLOT(_q_processWindowStateChanged(Qt::WindowStates,Qt::WindowStates)));
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::place(Placer *placer, QMdiSubWindow *child)
-{
-    if (!placer || !child)
-        return;
-
-    Q_Q(QMdiArea);
-    if (!q->isVisible()) {
-        // The window is only laid out when it's added to QMdiArea,
-        // so there's no need to check that we don't have it in the
-        // list already. appendChild() ensures that.
-        pendingPlacements.append(child);
-        return;
-    }
-
-    QList<QRect> rects;
-    QRect parentRect = q->rect();
-    foreach (QMdiSubWindow *window, childWindows) {
-        if (!sanityCheck(window, "QMdiArea::place") || window == child || !window->isVisibleTo(q)
-                || !window->testAttribute(Qt::WA_Moved)) {
-            continue;
-        }
-        QRect occupiedGeometry;
-        if (window->isMaximized()) {
-            occupiedGeometry = QRect(window->d_func()->oldGeometry.topLeft(),
-                                     window->d_func()->restoreSize);
-        } else {
-            occupiedGeometry = window->geometry();
-        }
-        rects.append(QStyle::visualRect(child->layoutDirection(), parentRect, occupiedGeometry));
-    }
-    QPoint newPos = placer->place(child->size(), rects, parentRect);
-    QRect newGeometry = QRect(newPos.x(), newPos.y(), child->width(), child->height());
-    child->setGeometry(QStyle::visualRect(child->layoutDirection(), parentRect, newGeometry));
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::rearrange(Rearranger *rearranger)
-{
-    if (!rearranger)
-        return;
-
-    Q_Q(QMdiArea);
-    if (!q->isVisible()) {
-        // Compress if we already have the rearranger in the list.
-        int index = pendingRearrangements.indexOf(rearranger);
-        if (index != -1)
-            pendingRearrangements.move(index, pendingRearrangements.size() - 1);
-        else
-            pendingRearrangements.append(rearranger);
-        return;
-    }
-
-    QList<QWidget *> widgets;
-    const bool reverseList = rearranger->type() == Rearranger::RegularTiler;
-    const QList<QMdiSubWindow *> subWindows = subWindowList(activationOrder, reverseList);
-    QSize minSubWindowSize;
-    foreach (QMdiSubWindow *child, subWindows) {
-        if (!sanityCheck(child, "QMdiArea::rearrange") || !child->isVisible())
-            continue;
-        if (rearranger->type() == Rearranger::IconTiler) {
-            if (child->isMinimized() && !child->isShaded() && !(child->windowFlags() & Qt::FramelessWindowHint))
-                widgets.append(child);
-        } else {
-            if (child->isMinimized() && !child->isShaded())
-                continue;
-            if (child->isMaximized() || child->isShaded())
-                child->showNormal();
-            minSubWindowSize = minSubWindowSize.expandedTo(child->minimumSize())
-                               .expandedTo(child->d_func()->internalMinimumSize);
-            widgets.append(child);
-        }
-    }
-
-    if (active && rearranger->type() == Rearranger::RegularTiler) {
-        // Move active window in front if necessary. That's the case if we
-        // have any windows with staysOnTopHint set.
-        int indexToActive = widgets.indexOf((QWidget *)active);
-        if (indexToActive > 0)
-            widgets.move(indexToActive, 0);
-    }
-
-    QRect domain = viewport->rect();
-    if (rearranger->type() == Rearranger::RegularTiler && !widgets.isEmpty())
-        domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count());
-
-    rearranger->rearrange(widgets, domain);
-
-    if (rearranger->type() == Rearranger::RegularTiler && !widgets.isEmpty()) {
-        isSubWindowsTiled = true;
-        updateScrollBars();
-    } else if (rearranger->type() == Rearranger::SimpleCascader) {
-        isSubWindowsTiled = false;
-    }
-}
-
-/*!
-    \internal
-
-    Arranges all minimized windows at the bottom of the workspace.
-*/
-void QMdiAreaPrivate::arrangeMinimizedSubWindows()
-{
-    if (!iconTiler)
-        iconTiler = new IconTiler;
-    rearrange(iconTiler);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::activateWindow(QMdiSubWindow *child)
-{
-    if (childWindows.isEmpty()) {
-        Q_ASSERT(!child);
-        Q_ASSERT(!active);
-        return;
-    }
-
-    if (!child) {
-        if (active) {
-            Q_ASSERT(active->d_func()->isActive);
-            active->d_func()->setActive(false);
-            resetActiveWindow();
-        }
-        return;
-    }
-
-    if (child->isHidden() || child == active)
-        return;
-    child->d_func()->setActive(true);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::activateCurrentWindow()
-{
-    QMdiSubWindow *current = q_func()->currentSubWindow();
-    if (current && !isExplicitlyDeactivated(current)) {
-        current->d_func()->activationEnabled = true;
-        current->d_func()->setActive(true, /*changeFocus=*/false);
-    }
-}
-
-void QMdiAreaPrivate::activateHighlightedWindow()
-{
-    if (indexToHighlighted < 0)
-        return;
-
-    Q_ASSERT(indexToHighlighted < childWindows.size());
-    if (tabToPreviousTimerId != -1)
-        activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder));
-    else
-        activateWindow(childWindows.at(indexToHighlighted));
-#ifndef QT_NO_RUBBERBAND
-    hideRubberBand();
-#endif
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow)
-{
-    Q_Q(QMdiArea);
-    Q_ASSERT(activeWindow);
-    if (activeWindow == active)
-        return;
-    Q_ASSERT(activeWindow->d_func()->isActive);
-
-    if (!aboutToBecomeActive)
-        _q_deactivateAllWindows(activeWindow);
-    Q_ASSERT(aboutToBecomeActive);
-
-    // This is true only if 'DontMaximizeSubWindowOnActivation' is disabled
-    // and the previous active window was maximized.
-    if (showActiveWindowMaximized) {
-        if (!activeWindow->isMaximized())
-            activeWindow->showMaximized();
-        showActiveWindowMaximized = false;
-    }
-
-    // Put in front to update activation order.
-    const int indexToActiveWindow = childWindows.indexOf(activeWindow);
-    Q_ASSERT(indexToActiveWindow != -1);
-    const int index = indicesToActivatedChildren.indexOf(indexToActiveWindow);
-    Q_ASSERT(index != -1);
-    indicesToActivatedChildren.move(index, 0);
-    internalRaise(activeWindow);
-
-    if (updatesDisabledByUs) {
-        q->setUpdatesEnabled(true);
-        updatesDisabledByUs = false;
-    }
-
-    Q_ASSERT(aboutToBecomeActive == activeWindow);
-    active = activeWindow;
-    aboutToBecomeActive = 0;
-    Q_ASSERT(active->d_func()->isActive);
-
-#ifndef QT_NO_TABBAR
-    if (tabBar && tabBar->currentIndex() != indexToActiveWindow)
-        tabBar->setCurrentIndex(indexToActiveWindow);
-#endif
-
-    if (active->isMaximized() && scrollBarsEnabled())
-        updateScrollBars();
-
-    emit q->subWindowActivated(active);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::resetActiveWindow(QMdiSubWindow *deactivatedWindow)
-{
-    Q_Q(QMdiArea);
-    if (deactivatedWindow) {
-        if (deactivatedWindow != active)
-            return;
-        active = 0;
-        if ((aboutToBecomeActive || isActivated || lastWindowAboutToBeDestroyed())
-            && !isExplicitlyDeactivated(deactivatedWindow) && !q->window()->isMinimized()) {
-            return;
-        }
-        emit q->subWindowActivated(0);
-        return;
-    }
-
-    if (aboutToBecomeActive)
-        return;
-
-    active = 0;
-    emit q->subWindowActivated(0);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved)
-{
-    Q_ASSERT(indicesToActivatedChildren.size() == childWindows.size());
-
-#ifndef QT_NO_TABBAR
-    if (tabBar && removedIndex >= 0) {
-        tabBar->blockSignals(true);
-        tabBar->removeTab(removedIndex);
-        updateTabBarGeometry();
-        tabBar->blockSignals(false);
-    }
-#endif
-
-    if (childWindows.isEmpty()) {
-        showActiveWindowMaximized = false;
-        resetActiveWindow();
-        return;
-    }
-
-    if (indexToHighlighted >= 0) {
-#ifndef QT_NO_RUBBERBAND
-        // Hide rubber band if highlighted window is removed.
-        if (indexToHighlighted == removedIndex)
-            hideRubberBand();
-        else
-#endif
-        // or update index if necessary.
-        if (indexToHighlighted > removedIndex)
-            --indexToHighlighted;
-    }
-
-    // Update indices list
-    for (int i = 0; i < indicesToActivatedChildren.size(); ++i) {
-        int *index = &indicesToActivatedChildren[i];
-        if (*index > removedIndex)
-            --*index;
-    }
-
-    if (!activeRemoved)
-        return;
-
-    // Activate next window.
-    QMdiSubWindow *next = nextVisibleSubWindow(0, activationOrder, removedIndex);
-    if (next)
-        activateWindow(next);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::updateScrollBars()
-{
-    if (ignoreGeometryChange || !scrollBarsEnabled())
-        return;
-
-    Q_Q(QMdiArea);
-    QSize maxSize = q->maximumViewportSize();
-    QSize hbarExtent = hbar->sizeHint();
-    QSize vbarExtent = vbar->sizeHint();
-
-    if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) {
-        const int doubleFrameWidth = frameWidth * 2;
-        if (hbarpolicy == Qt::ScrollBarAlwaysOn)
-            maxSize.rheight() -= doubleFrameWidth;
-        if (vbarpolicy == Qt::ScrollBarAlwaysOn)
-            maxSize.rwidth() -= doubleFrameWidth;
-        hbarExtent.rheight() += doubleFrameWidth;
-        vbarExtent.rwidth() += doubleFrameWidth;
-    }
-
-    const QRect childrenRect = active && active->isMaximized()
-                               ? active->geometry() : viewport->childrenRect();
-    bool useHorizontalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Horizontal);
-    bool useVerticalScrollBar = useScrollBar(childrenRect, maxSize, Qt::Vertical);
-
-    if (useHorizontalScrollBar && !useVerticalScrollBar) {
-        const QSize max = maxSize - QSize(0, hbarExtent.height());
-        useVerticalScrollBar = useScrollBar(childrenRect, max, Qt::Vertical);
-    }
-
-    if (useVerticalScrollBar && !useHorizontalScrollBar) {
-        const QSize max = maxSize - QSize(vbarExtent.width(), 0);
-        useHorizontalScrollBar = useScrollBar(childrenRect, max, Qt::Horizontal);
-    }
-
-    if (useHorizontalScrollBar && hbarpolicy != Qt::ScrollBarAlwaysOn)
-        maxSize.rheight() -= hbarExtent.height();
-    if (useVerticalScrollBar && vbarpolicy != Qt::ScrollBarAlwaysOn)
-        maxSize.rwidth() -= vbarExtent.width();
-
-    QRect viewportRect(QPoint(0, 0), maxSize);
-    const int startX = q->isLeftToRight() ? childrenRect.left() : viewportRect.right()
-                                                                  - childrenRect.right();
-
-    // Horizontal scroll bar.
-    if (isSubWindowsTiled && hbar->value() != 0)
-        hbar->setValue(0);
-    const int xOffset = startX + hbar->value();
-    hbar->setRange(qMin(0, xOffset),
-                   qMax(0, xOffset + childrenRect.width() - viewportRect.width()));
-    hbar->setPageStep(childrenRect.width());
-    hbar->setSingleStep(childrenRect.width() / 20);
-
-    // Vertical scroll bar.
-    if (isSubWindowsTiled && vbar->value() != 0)
-        vbar->setValue(0);
-    const int yOffset = childrenRect.top() + vbar->value();
-    vbar->setRange(qMin(0, yOffset),
-                   qMax(0, yOffset + childrenRect.height() - viewportRect.height()));
-    vbar->setPageStep(childrenRect.height());
-    vbar->setSingleStep(childrenRect.height() / 20);
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const
-{
-    if (!sanityCheck(mdiChild, "QMdiArea::internalRaise") || childWindows.size() < 2)
-        return;
-
-    QMdiSubWindow *stackUnderChild = 0;
-    if (!windowStaysOnTop(mdiChild)) {
-        foreach (QObject *object, viewport->children()) {
-            QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);
-            if (!child || !childWindows.contains(child))
-                continue;
-            if (!child->isHidden() && windowStaysOnTop(child)) {
-                if (stackUnderChild)
-                    child->stackUnder(stackUnderChild);
-                else
-                    child->raise();
-                stackUnderChild = child;
-            }
-        }
-    }
-
-    if (stackUnderChild)
-        mdiChild->stackUnder(stackUnderChild);
-    else
-        mdiChild->raise();
-}
-
-QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount)
-{
-    Q_Q(QMdiArea);
-    if (!minSubWindowSize.isValid() || subWindowCount <= 0)
-        return viewport->rect();
-
-    // Calculate minimum size.
-    const int columns = qMax(qCeil(qSqrt(qreal(subWindowCount))), 1);
-    const int rows = qMax((subWindowCount % columns) ? (subWindowCount / columns + 1)
-                                                     : (subWindowCount / columns), 1);
-    const int minWidth = minSubWindowSize.width() * columns;
-    const int minHeight = minSubWindowSize.height() * rows;
-
-    // Increase area size if necessary. Scroll bars are provided if we're not able
-    // to resize to the minimum size.
-    if (!tileCalledFromResizeEvent) {
-        QWidget *topLevel = q;
-        // Find the topLevel for this area, either a real top-level or a sub-window.
-        while (topLevel && !topLevel->isWindow() && topLevel->windowType() != Qt::SubWindow)
-            topLevel = topLevel->parentWidget();
-        // We don't want sub-subwindows to be placed at the edge, thus add 2 pixels.
-        int minAreaWidth = minWidth + left + right + 2;
-        int minAreaHeight = minHeight + top + bottom + 2;
-        if (hbar->isVisible())
-            minAreaHeight += hbar->height();
-        if (vbar->isVisible())
-            minAreaWidth += vbar->width();
-        if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) {
-            const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q);
-            minAreaWidth += 2 * frame;
-            minAreaHeight += 2 * frame;
-        }
-        const QSize diff = QSize(minAreaWidth, minAreaHeight).expandedTo(q->size()) - q->size();
-        topLevel->resize(topLevel->size() + diff);
-    }
-
-    QRect domain = viewport->rect();
-
-    // Adjust domain width and provide horizontal scroll bar.
-    if (domain.width() < minWidth) {
-        domain.setWidth(minWidth);
-        if (hbarpolicy == Qt::ScrollBarAlwaysOff)
-            q->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-        else
-            hbar->setValue(0);
-    }
-    // Adjust domain height and provide vertical scroll bar.
-    if (domain.height() < minHeight) {
-        domain.setHeight(minHeight);
-        if (vbarpolicy  == Qt::ScrollBarAlwaysOff)
-            q->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-        else
-            vbar->setValue(0);
-    }
-    return domain;
-}
-
-/*!
-    \internal
-*/
-bool QMdiAreaPrivate::scrollBarsEnabled() const
-{
-    return hbarpolicy != Qt::ScrollBarAlwaysOff || vbarpolicy != Qt::ScrollBarAlwaysOff;
-}
-
-/*!
-    \internal
-*/
-bool QMdiAreaPrivate::lastWindowAboutToBeDestroyed() const
-{
-    if (childWindows.count() != 1)
-        return false;
-
-    QMdiSubWindow *last = childWindows.at(0);
-    if (!last)
-        return true;
-
-    if (!last->testAttribute(Qt::WA_DeleteOnClose))
-        return false;
-
-    return last->d_func()->data.is_closing;
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::setChildActivationEnabled(bool enable, bool onlyNextActivationEvent) const
-{
-    foreach (QMdiSubWindow *subWindow, childWindows) {
-        if (!subWindow || !subWindow->isVisible())
-            continue;
-        if (onlyNextActivationEvent)
-            subWindow->d_func()->ignoreNextActivationEvent = !enable;
-        else
-            subWindow->d_func()->activationEnabled = enable;
-    }
-}
-
-/*!
-    \internal
-    \reimp
-*/
-void QMdiAreaPrivate::scrollBarPolicyChanged(Qt::Orientation orientation, Qt::ScrollBarPolicy policy)
-{
-    if (childWindows.isEmpty())
-        return;
-
-    const QMdiSubWindow::SubWindowOption option = orientation == Qt::Horizontal ?
-        QMdiSubWindow::AllowOutsideAreaHorizontally : QMdiSubWindow::AllowOutsideAreaVertically;
-    const bool enable = policy != Qt::ScrollBarAlwaysOff;
-    foreach (QMdiSubWindow *child, childWindows) {
-        if (!sanityCheck(child, "QMdiArea::scrollBarPolicyChanged"))
-            continue;
-        child->setOption(option, enable);
-    }
-    updateScrollBars();
-}
-
-QList<QMdiSubWindow*>
-QMdiAreaPrivate::subWindowList(QMdiArea::WindowOrder order, bool reversed) const
-{
-    QList<QMdiSubWindow *> list;
-    if (childWindows.isEmpty())
-        return list;
-
-    if (order == QMdiArea::CreationOrder) {
-        foreach (QMdiSubWindow *child, childWindows) {
-            if (!child)
-                continue;
-            if (!reversed)
-                list.append(child);
-            else
-                list.prepend(child);
-        }
-    } else if (order == QMdiArea::StackingOrder) {
-        foreach (QObject *object, viewport->children()) {
-            QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);
-            if (!child || !childWindows.contains(child))
-                continue;
-            if (!reversed)
-                list.append(child);
-            else
-                list.prepend(child);
-        }
-    } else { // ActivationHistoryOrder
-        Q_ASSERT(indicesToActivatedChildren.size() == childWindows.size());
-        for (int i = indicesToActivatedChildren.count() - 1; i >= 0; --i) {
-            QMdiSubWindow *child = childWindows.at(indicesToActivatedChildren.at(i));
-            if (!child)
-                continue;
-            if (!reversed)
-                list.append(child);
-            else
-                list.prepend(child);
-        }
-    }
-    return list;
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::disconnectSubWindow(QObject *subWindow)
-{
-    if (!subWindow)
-        return;
-
-    Q_Q(QMdiArea);
-    QObject::disconnect(subWindow, 0, q, 0);
-    subWindow->removeEventFilter(q);
-}
-
-/*!
-    \internal
-*/
-QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder order,
-                                                     int removedIndex, int fromIndex) const
-{
-    if (childWindows.isEmpty())
-        return 0;
-
-    Q_Q(const QMdiArea);
-    const QList<QMdiSubWindow *> subWindows = q->subWindowList(order);
-    QMdiSubWindow *current = 0;
-
-    if (removedIndex < 0) {
-        if (fromIndex >= 0 && fromIndex < subWindows.size())
-            current = childWindows.at(fromIndex);
-        else
-            current = q->currentSubWindow();
-    }
-
-    // There's no current sub-window (removed or deactivated),
-    // so we have to pick the last active or the next in creation order.
-    if (!current) {
-        if (removedIndex >= 0 && order == QMdiArea::CreationOrder) {
-            int candidateIndex = -1;
-            setIndex(&candidateIndex, removedIndex, 0, subWindows.size() - 1, true);
-            current = childWindows.at(candidateIndex);
-        } else {
-            current = subWindows.back();
-        }
-    }
-    Q_ASSERT(current);
-
-    // Find the index for the current sub-window in the given activation order
-    const int indexToCurrent = subWindows.indexOf(current);
-    const bool increasing = (increaseFactor > 0);
-
-    // and use that index + increseFactor as a candidate.
-    int index = -1;
-    setIndex(&index, indexToCurrent + increaseFactor, 0, subWindows.size() - 1, increasing);
-    Q_ASSERT(index != -1);
-
-    // Try to find another window if the candidate is hidden.
-    while (subWindows.at(index)->isHidden()) {
-        setIndex(&index, index + increaseFactor, 0, subWindows.size() - 1, increasing);
-        if (index == indexToCurrent)
-            break;
-    }
-
-    if (!subWindows.at(index)->isHidden())
-        return subWindows.at(index);
-    return 0;
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
-{
-    if (childWindows.size() == 1)
-        return;
-
-    Q_Q(QMdiArea);
-    // There's no highlighted sub-window atm, use current.
-    if (indexToHighlighted < 0) {
-        QMdiSubWindow *current = q->currentSubWindow();
-        if (!current)
-            return;
-        indexToHighlighted = childWindows.indexOf(current);
-    }
-
-    Q_ASSERT(indexToHighlighted >= 0);
-    Q_ASSERT(indexToHighlighted < childWindows.size());
-
-    QMdiSubWindow *highlight = nextVisibleSubWindow(increaseFactor, activationOrder, -1, indexToHighlighted);
-    if (!highlight)
-        return;
-
-#ifndef QT_NO_RUBBERBAND
-    if (!rubberBand) {
-        rubberBand = new QRubberBand(QRubberBand::Rectangle, viewport);
-        // For accessibility to identify this special widget.
-        rubberBand->setObjectName(QLatin1String("qt_rubberband"));
-        rubberBand->setWindowFlags(rubberBand->windowFlags() | Qt::WindowStaysOnTopHint);
-    }
-#endif
-
-    // Only highlight if we're not switching back to the previously active window (Ctrl-Tab once).
-#ifndef QT_NO_RUBBERBAND
-    if (tabToPreviousTimerId == -1)
-        showRubberBandFor(highlight);
-#endif
-
-    indexToHighlighted = childWindows.indexOf(highlight);
-    Q_ASSERT(indexToHighlighted >= 0);
-}
-
-/*!
-    \internal
-    \since 4.4
-*/
-void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
-{
-    Q_Q(QMdiArea);
-    if (viewMode == mode || inViewModeChange)
-        return;
-
-    // Just a guard since we cannot set viewMode = mode here.
-    inViewModeChange = true;
-
-#ifndef QT_NO_TABBAR
-    if (mode == QMdiArea::TabbedView) {
-        Q_ASSERT(!tabBar);
-        tabBar = new QMdiAreaTabBar(q);
-        tabBar->setDocumentMode(documentMode);
-        tabBar->setTabsClosable(tabsClosable);
-        tabBar->setMovable(tabsMovable);
-#ifndef QT_NO_TABWIDGET
-        tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition));
-#endif
-
-        isSubWindowsTiled = false;
-
-        foreach (QMdiSubWindow *subWindow, childWindows)
-            tabBar->addTab(subWindow->windowIcon(), tabTextFor(subWindow));
-
-        QMdiSubWindow *current = q->currentSubWindow();
-        if (current) {
-            tabBar->setCurrentIndex(childWindows.indexOf(current));
-            // Restore sub-window (i.e. cleanup buttons in menu bar and window title).
-            if (current->isMaximized())
-                current->showNormal();
-
-            viewMode = mode;
-
-            // Now, maximize it.
-            if (!q->testOption(QMdiArea::DontMaximizeSubWindowOnActivation)) {
-                current->showMaximized();
-            }
-        } else {
-            viewMode = mode;
-        }
-
-        if (q->isVisible())
-            tabBar->show();
-        updateTabBarGeometry();
-
-        QObject::connect(tabBar, SIGNAL(currentChanged(int)), q, SLOT(_q_currentTabChanged(int)));
-        QObject::connect(tabBar, SIGNAL(tabCloseRequested(int)), q, SLOT(_q_closeTab(int)));
-        QObject::connect(tabBar, SIGNAL(tabMoved(int,int)), q, SLOT(_q_moveTab(int,int)));
-    } else
-#endif // QT_NO_TABBAR
-    { // SubWindowView
-#ifndef QT_NO_TABBAR
-        delete tabBar;
-        tabBar = 0;
-#endif // QT_NO_TABBAR
-
-        viewMode = mode;
-        q->setViewportMargins(0, 0, 0, 0);
-        indexToLastActiveTab = -1;
-
-        QMdiSubWindow *current = q->currentSubWindow();
-        if (current && current->isMaximized())
-            current->showNormal();
-    }
-
-    Q_ASSERT(viewMode == mode);
-    inViewModeChange = false;
-}
-
-#ifndef QT_NO_TABBAR
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::updateTabBarGeometry()
-{
-    if (!tabBar)
-        return;
-
-    Q_Q(QMdiArea);
-#ifndef QT_NO_TABWIDGET
-    Q_ASSERT(tabBarShapeFrom(tabShape, tabPosition) == tabBar->shape());
-#endif
-    const QSize tabBarSizeHint = tabBar->sizeHint();
-
-    int areaHeight = q->height();
-    if (hbar && hbar->isVisible())
-        areaHeight -= hbar->height();
-
-    int areaWidth = q->width();
-    if (vbar && vbar->isVisible())
-        areaWidth -= vbar->width();
-
-    QRect tabBarRect;
-#ifndef QT_NO_TABWIDGET
-    switch (tabPosition) {
-    case QTabWidget::North:
-        q->setViewportMargins(0, tabBarSizeHint.height(), 0, 0);
-        tabBarRect = QRect(0, 0, areaWidth, tabBarSizeHint.height());
-        break;
-    case QTabWidget::South:
-        q->setViewportMargins(0, 0, 0, tabBarSizeHint.height());
-        tabBarRect = QRect(0, areaHeight - tabBarSizeHint.height(), areaWidth, tabBarSizeHint.height());
-        break;
-    case QTabWidget::East:
-        if (q->layoutDirection() == Qt::LeftToRight)
-            q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
-        else
-            q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
-        tabBarRect = QRect(areaWidth - tabBarSizeHint.width(), 0, tabBarSizeHint.width(), areaHeight);
-        break;
-    case QTabWidget::West:
-        if (q->layoutDirection() == Qt::LeftToRight)
-            q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
-        else
-            q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
-        tabBarRect = QRect(0, 0, tabBarSizeHint.width(), areaHeight);
-        break;
-    default:
-        break;
-    }
-#endif // QT_NO_TABWIDGET
-
-    tabBar->setGeometry(QStyle::visualRect(q->layoutDirection(), q->contentsRect(), tabBarRect));
-}
-
-/*!
-    \internal
-*/
-void QMdiAreaPrivate::refreshTabBar()
-{
-    if (!tabBar)
-        return;
-
-    tabBar->setDocumentMode(documentMode);
-    tabBar->setTabsClosable(tabsClosable);
-    tabBar->setMovable(tabsMovable);
-#ifndef QT_NO_TABWIDGET
-    tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition));
-#endif
-    updateTabBarGeometry();
-}
-#endif // QT_NO_TABBAR
-
-/*!
-    Constructs an empty mdi area. \a parent is passed to QWidget's
-    constructor.
-*/
-QMdiArea::QMdiArea(QWidget *parent)
-    : QAbstractScrollArea(*new QMdiAreaPrivate, parent)
-{
-    setBackground(palette().brush(QPalette::Dark));
-    setFrameStyle(QFrame::NoFrame);
-    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setViewport(0);
-    setFocusPolicy(Qt::NoFocus);
-    QApplication::instance()->installEventFilter(this);
-}
-
-/*!
-    Destroys the MDI area.
-*/
-QMdiArea::~QMdiArea()
-{
-    Q_D(QMdiArea);
-    delete d->cascader;
-    d->cascader = 0;
-
-    delete d->regularTiler;
-    d->regularTiler = 0;
-
-    delete d->iconTiler;
-    d->iconTiler = 0;
-
-    delete d->placer;
-    d->placer = 0;
-}
-
-/*!
-    \reimp
-*/
-QSize QMdiArea::sizeHint() const
-{
-    // Calculate a proper scale factor for QDesktopWidget::size().
-    // This also takes into account that we can have nested workspaces.
-    int nestedCount = 0;
-    QWidget *widget = this->parentWidget();
-    while (widget) {
-        if (qobject_cast<QMdiArea *>(widget))
-            ++nestedCount;
-        widget = widget->parentWidget();
-    }
-    const int scaleFactor = 3 * (nestedCount + 1);
-
-    QSize desktopSize = QApplication::desktop()->size();
-    QSize size(desktopSize.width() * 2 / scaleFactor, desktopSize.height() * 2 / scaleFactor);
-    foreach (QMdiSubWindow *child, d_func()->childWindows) {
-        if (!sanityCheck(child, "QMdiArea::sizeHint"))
-            continue;
-        size = size.expandedTo(child->sizeHint());
-    }
-    return size.expandedTo(QApplication::globalStrut());
-}
-
-/*!
-    \reimp
-*/
-QSize QMdiArea::minimumSizeHint() const
-{
-    Q_D(const QMdiArea);
-    QSize size(style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, this),
-               style()->pixelMetric(QStyle::PM_TitleBarHeight, 0, this));
-    size = size.expandedTo(QAbstractScrollArea::minimumSizeHint());
-    if (!d->scrollBarsEnabled()) {
-        foreach (QMdiSubWindow *child, d->childWindows) {
-            if (!sanityCheck(child, "QMdiArea::sizeHint"))
-                continue;
-            size = size.expandedTo(child->minimumSizeHint());
-        }
-    }
-    return size.expandedTo(QApplication::globalStrut());
-}
-
-/*!
-    Returns a pointer to the current subwindow, or 0 if there is
-    no current subwindow.
-
-    This function will return the same as activeSubWindow() if
-    the QApplication containing QMdiArea is active.
-
-    \sa activeSubWindow(), QApplication::activeWindow()
-*/
-QMdiSubWindow *QMdiArea::currentSubWindow() const
-{
-    Q_D(const QMdiArea);
-    if (d->childWindows.isEmpty())
-        return 0;
-
-    if (d->active)
-        return d->active;
-
-    if (d->isActivated && !window()->isMinimized())
-        return 0;
-
-    Q_ASSERT(d->indicesToActivatedChildren.count() > 0);
-    int index = d->indicesToActivatedChildren.at(0);
-    Q_ASSERT(index >= 0 && index < d->childWindows.size());
-    QMdiSubWindow *current = d->childWindows.at(index);
-    Q_ASSERT(current);
-    return current;
-}
-
-/*!
-    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.
-
-    \sa setActiveSubWindow(), Qt::WindowState
-*/
-QMdiSubWindow *QMdiArea::activeSubWindow() const
-{
-    Q_D(const QMdiArea);
-    return d->active;
-}
-
-/*!
-    Activates the subwindow \a window. If \a window is 0, any
-    current active window is deactivated.
-
-    \sa activeSubWindow()
-*/
-void QMdiArea::setActiveSubWindow(QMdiSubWindow *window)
-{
-    Q_D(QMdiArea);
-    if (!window) {
-        d->activateWindow(0);
-        return;
-    }
-
-    if (d->childWindows.isEmpty()) {
-        qWarning("QMdiArea::setActiveSubWindow: workspace is empty");
-        return;
-    }
-
-    if (d->childWindows.indexOf(window) == -1) {
-        qWarning("QMdiArea::setActiveSubWindow: window is not inside workspace");
-        return;
-    }
-
-    d->activateWindow(window);
-}
-
-/*!
-    Closes the active subwindow.
-
-    \sa closeAllSubWindows()
-*/
-void QMdiArea::closeActiveSubWindow()
-{
-    Q_D(QMdiArea);
-    if (d->active)
-        d->active->close();
-}
-
-/*!
-    Returns a list of all subwindows in the MDI area. If \a order is
-    CreationOrder (the default), the windows are sorted in the order
-    in which they were inserted into the workspace. If \a order is
-    StackingOrder, the windows are listed in their stacking order,
-    with the topmost window as the last item in the list. If \a order
-    is ActivationHistoryOrder, the windows are listed according to
-    their recent activation history.
-
-    \sa WindowOrder
-*/
-QList<QMdiSubWindow *> QMdiArea::subWindowList(WindowOrder order) const
-{
-    Q_D(const QMdiArea);
-    return d->subWindowList(order, false);
-}
-
-/*!
-    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.
-
-    \sa closeActiveSubWindow()
-*/
-void QMdiArea::closeAllSubWindows()
-{
-    Q_D(QMdiArea);
-    if (d->childWindows.isEmpty())
-        return;
-
-    d->isSubWindowsTiled = false;
-    foreach (QMdiSubWindow *child, d->childWindows) {
-        if (!sanityCheck(child, "QMdiArea::closeAllSubWindows"))
-            continue;
-        child->close();
-    }
-
-    d->updateScrollBars();
-}
-
-/*!
-    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 \l{QMdiArea::WindowOrder} {activation order}.
-
-    \sa activatePreviousSubWindow(), QMdiArea::WindowOrder
-*/
-void QMdiArea::activateNextSubWindow()
-{
-    Q_D(QMdiArea);
-    if (d->childWindows.isEmpty())
-        return;
-
-    QMdiSubWindow *next = d->nextVisibleSubWindow(1, d->activationOrder);
-    if (next)
-        d->activateWindow(next);
-}
-
-/*!
-    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 \l{QMdiArea::WindowOrder} {activation order}.
-
-    \sa activateNextSubWindow(), QMdiArea::WindowOrder
-*/
-void QMdiArea::activatePreviousSubWindow()
-{
-    Q_D(QMdiArea);
-    if (d->childWindows.isEmpty())
-        return;
-
-    QMdiSubWindow *previous = d->nextVisibleSubWindow(-1, d->activationOrder);
-    if (previous)
-        d->activateWindow(previous);
-}
-
-/*!
-    Adds \a widget as a new subwindow to the MDI area.  If \a
-    windowFlags are non-zero, they will override the flags set on the
-    widget.
-
-    The \a widget can be either a QMdiSubWindow or another QWidget
-    (in which case the MDI area will create a subwindow and set the \a
-    widget as the internal widget).
-
-    \note Once the subwindow has been added, its parent will be the
-    \e{viewport widget} of the QMdiArea.
-
-    \snippet doc/src/snippets/mdiareasnippets.cpp 1
-
-    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.
-
-    Returns the QMdiSubWindow that is added to the MDI area.
-
-    \sa removeSubWindow()
-*/
-QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags)
-{
-    if (!widget) {
-        qWarning("QMdiArea::addSubWindow: null pointer to widget");
-        return 0;
-    }
-
-    Q_D(QMdiArea);
-    // QWidget::setParent clears focusWidget so store it
-    QWidget *childFocus = widget->focusWidget();
-    QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget);
-
-    // Widget is already a QMdiSubWindow
-    if (child) {
-        if (d->childWindows.indexOf(child) != -1) {
-            qWarning("QMdiArea::addSubWindow: window is already added");
-            return child;
-        }
-        child->setParent(viewport(), windowFlags ? windowFlags : child->windowFlags());
-    // Create a QMdiSubWindow
-    } else {
-        child = new QMdiSubWindow(viewport(), windowFlags);
-        child->setAttribute(Qt::WA_DeleteOnClose);
-        child->setWidget(widget);
-        Q_ASSERT(child->testAttribute(Qt::WA_DeleteOnClose));
-    }
-
-    if (childFocus)
-        childFocus->setFocus();
-    d->appendChild(child);
-    return child;
-}
-
-/*!
-    Removes \a widget from the MDI area. The \a widget must be
-    either a QMdiSubWindow or a widget that is the internal widget of
-    a subwindow. Note \a widget is never actually deleted by QMdiArea.
-    If a QMdiSubWindow is passed in its parent is set to 0 and it is
-    removed, but if an internal widget is passed in the child widget
-    is set to 0 but the QMdiSubWindow is not removed.
-
-    \sa addSubWindow()
-*/
-void QMdiArea::removeSubWindow(QWidget *widget)
-{
-    if (!widget) {
-        qWarning("QMdiArea::removeSubWindow: null pointer to widget");
-        return;
-    }
-
-    Q_D(QMdiArea);
-    if (d->childWindows.isEmpty())
-        return;
-
-    if (QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget)) {
-        int index = d->childWindows.indexOf(child);
-        if (index == -1) {
-            qWarning("QMdiArea::removeSubWindow: window is not inside workspace");
-            return;
-        }
-        d->disconnectSubWindow(child);
-        d->childWindows.removeAll(child);
-        d->indicesToActivatedChildren.removeAll(index);
-        d->updateActiveWindow(index, d->active == child);
-        child->setParent(0);
-        return;
-    }
-
-    bool found = false;
-    foreach (QMdiSubWindow *child, d->childWindows) {
-        if (!sanityCheck(child, "QMdiArea::removeSubWindow"))
-            continue;
-        if (child->widget() == widget) {
-            child->setWidget(0);
-            Q_ASSERT(!child->widget());
-            found = true;
-            break;
-        }
-    }
-
-    if (!found)
-        qWarning("QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea");
-}
-
-/*!
-    \property QMdiArea::background
-    \brief the background brush for the workspace
-
-    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).
-*/
-QBrush QMdiArea::background() const
-{
-    return d_func()->background;
-}
-
-void QMdiArea::setBackground(const QBrush &brush)
-{
-    Q_D(QMdiArea);
-    if (d->background != brush) {
-        d->background = brush;
-        d->viewport->setAttribute(Qt::WA_OpaquePaintEvent, brush.isOpaque());
-        update();
-    }
-}
-
-
-/*!
-    \property QMdiArea::activationOrder
-    \brief the ordering criteria for subwindow lists
-    \since 4.4
-
-    This property specifies the ordering criteria for the list of
-    subwindows returned by subWindowList(). By default, it is the window
-    creation order.
-
-    \sa subWindowList()
-*/
-QMdiArea::WindowOrder QMdiArea::activationOrder() const
-{
-    Q_D(const QMdiArea);
-    return d->activationOrder;
-}
-
-void QMdiArea::setActivationOrder(WindowOrder order)
-{
-    Q_D(QMdiArea);
-    if (order != d->activationOrder)
-        d->activationOrder = order;
-}
-
-/*!
-    If \a on is true, \a option is enabled on the MDI area; otherwise
-    it is disabled. See AreaOption for the effect of each option.
-
-    \sa AreaOption, testOption()
-*/
-void QMdiArea::setOption(AreaOption option, bool on)
-{
-    Q_D(QMdiArea);
-    if (on && !(d->options & option))
-        d->options |= option;
-    else if (!on && (d->options & option))
-        d->options &= ~option;
-}
-
-/*!
-    Returns true if \a option is enabled; otherwise returns false.
-
-    \sa AreaOption, setOption()
-*/
-bool QMdiArea::testOption(AreaOption option) const
-{
-    return d_func()->options & option;
-}
-
-/*!
-    \property QMdiArea::viewMode
-    \brief the way sub-windows are displayed in the QMdiArea.
-    \since 4.4
-
-    By default, the SubWindowView is used to display sub-windows.
-
-    \sa ViewMode, setTabShape(), setTabPosition()
-*/
-QMdiArea::ViewMode QMdiArea::viewMode() const
-{
-    Q_D(const QMdiArea);
-    return d->viewMode;
-}
-
-void QMdiArea::setViewMode(ViewMode mode)
-{
-    Q_D(QMdiArea);
-    d->setViewMode(mode);
-}
-
-#ifndef QT_NO_TABBAR
-/*!
-    \property QMdiArea::documentMode
-    \brief whether the tab bar is set to document mode in tabbed view mode.
-    \since 4.5
-
-    Document mode is disabled by default.
-
-    \sa QTabBar::documentMode, setViewMode()
-*/
-bool QMdiArea::documentMode() const
-{
-    Q_D(const QMdiArea);
-    return d->documentMode;
-}
-
-void QMdiArea::setDocumentMode(bool enabled)
-{
-    Q_D(QMdiArea);
-    if (d->documentMode == enabled)
-        return;
-
-    d->documentMode = enabled;
-    d->refreshTabBar();
-}
-
-/*!
-    \property QMdiArea::tabsClosable
-    \brief whether the tab bar should place close buttons on each tab in tabbed view mode.
-    \since 4.8
-
-    Tabs are not closable by default.
-
-    \sa QTabBar::tabsClosable, setViewMode()
-*/
-bool QMdiArea::tabsClosable() const
-{
-    Q_D(const QMdiArea);
-    return d->tabsClosable;
-}
-
-void QMdiArea::setTabsClosable(bool closable)
-{
-    Q_D(QMdiArea);
-    if (d->tabsClosable == closable)
-        return;
-
-    d->tabsClosable = closable;
-    d->refreshTabBar();
-}
-
-/*!
-    \property QMdiArea::tabsMovable
-    \brief whether the user can move the tabs within the tabbar area in tabbed view mode.
-    \since 4.8
-
-    Tabs are not movable by default.
-
-    \sa QTabBar::movable, setViewMode()
-*/
-bool QMdiArea::tabsMovable() const
-{
-    Q_D(const QMdiArea);
-    return d->tabsMovable;
-}
-
-void QMdiArea::setTabsMovable(bool movable)
-{
-    Q_D(QMdiArea);
-    if (d->tabsMovable == movable)
-        return;
-
-    d->tabsMovable = movable;
-    d->refreshTabBar();
-}
-#endif // QT_NO_TABBAR
-
-#ifndef QT_NO_TABWIDGET
-/*!
-    \property QMdiArea::tabShape
-    \brief the shape of the tabs in tabbed view mode.
-    \since 4.4
-
-    Possible values for this property are QTabWidget::Rounded
-    (default) or QTabWidget::Triangular.
-
-    \sa QTabWidget::TabShape, setViewMode()
-*/
-QTabWidget::TabShape QMdiArea::tabShape() const
-{
-    Q_D(const QMdiArea);
-    return d->tabShape;
-}
-
-void QMdiArea::setTabShape(QTabWidget::TabShape shape)
-{
-    Q_D(QMdiArea);
-    if (d->tabShape == shape)
-        return;
-
-    d->tabShape = shape;
-    d->refreshTabBar();
-}
-
-/*!
-    \property QMdiArea::tabPosition
-    \brief the position of the tabs in tabbed view mode.
-    \since 4.4
-
-    Possible values for this property are described by the
-    QTabWidget::TabPosition enum.
-
-    \sa QTabWidget::TabPosition, setViewMode()
-*/
-QTabWidget::TabPosition QMdiArea::tabPosition() const
-{
-    Q_D(const QMdiArea);
-    return d->tabPosition;
-}
-
-void QMdiArea::setTabPosition(QTabWidget::TabPosition position)
-{
-    Q_D(QMdiArea);
-    if (d->tabPosition == position)
-        return;
-
-    d->tabPosition = position;
-    d->refreshTabBar();
-}
-#endif // QT_NO_TABWIDGET
-
-/*!
-    \reimp
-*/
-void QMdiArea::childEvent(QChildEvent *childEvent)
-{
-    Q_D(QMdiArea);
-    if (childEvent->type() == QEvent::ChildPolished) {
-        if (QMdiSubWindow *mdiChild = qobject_cast<QMdiSubWindow *>(childEvent->child())) {
-            if (d->childWindows.indexOf(mdiChild) == -1)
-                d->appendChild(mdiChild);
-        }
-    }
-}
-
-/*!
-    \reimp
-*/
-void QMdiArea::resizeEvent(QResizeEvent *resizeEvent)
-{
-    Q_D(QMdiArea);
-    if (d->childWindows.isEmpty()) {
-        resizeEvent->ignore();
-        return;
-    }
-
-#ifndef QT_NO_TABBAR
-    d->updateTabBarGeometry();
-#endif
-
-    // Re-tile the views if we're in tiled mode. Re-tile means we will change
-    // the geometry of the children, which in turn means 'isSubWindowsTiled'
-    // is set to false, so we have to update the state at the end.
-    if (d->isSubWindowsTiled) {
-        d->tileCalledFromResizeEvent = true;
-        tileSubWindows();
-        d->tileCalledFromResizeEvent = false;
-        d->isSubWindowsTiled = true;
-        d->startResizeTimer();
-        // We don't have scroll bars or any maximized views.
-        return;
-    }
-
-    // Resize maximized views.
-    bool hasMaximizedSubWindow = false;
-    foreach (QMdiSubWindow *child, d->childWindows) {
-        if (sanityCheck(child, "QMdiArea::resizeEvent") && child->isMaximized()
-                && child->size() != resizeEvent->size()) {
-            child->resize(resizeEvent->size());
-            if (!hasMaximizedSubWindow)
-                hasMaximizedSubWindow = true;
-        }
-    }
-
-    d->updateScrollBars();
-
-    // Minimized views are stacked under maximized views so there's
-    // no need to re-arrange minimized views on-demand. Start a timer
-    // just to make things faster with subsequent resize events.
-    if (hasMaximizedSubWindow)
-        d->startResizeTimer();
-    else
-        d->arrangeMinimizedSubWindows();
-}
-
-/*!
-    \reimp
-*/
-void QMdiArea::timerEvent(QTimerEvent *timerEvent)
-{
-    Q_D(QMdiArea);
-    if (timerEvent->timerId() == d->resizeTimerId) {
-        killTimer(d->resizeTimerId);
-        d->resizeTimerId = -1;
-        d->arrangeMinimizedSubWindows();
-    } else if (timerEvent->timerId() == d->tabToPreviousTimerId) {
-        killTimer(d->tabToPreviousTimerId);
-        d->tabToPreviousTimerId = -1;
-        if (d->indexToHighlighted < 0)
-            return;
-#ifndef QT_NO_RUBBERBAND
-        // We're not doing a "quick switch" ... show rubber band.
-        Q_ASSERT(d->indexToHighlighted < d->childWindows.size());
-        Q_ASSERT(d->rubberBand);
-        d->showRubberBandFor(d->childWindows.at(d->indexToHighlighted));
-#endif
-    }
-}
-
-/*!
-    \reimp
-*/
-void QMdiArea::showEvent(QShowEvent *showEvent)
-{
-    Q_D(QMdiArea);
-    if (!d->pendingRearrangements.isEmpty()) {
-        bool skipPlacement = false;
-        foreach (Rearranger *rearranger, d->pendingRearrangements) {
-            // If this is the case, we don't have to lay out pending child windows
-            // since the rearranger will find a placement for them.
-            if (rearranger->type() != Rearranger::IconTiler && !skipPlacement)
-                skipPlacement = true;
-            d->rearrange(rearranger);
-        }
-        d->pendingRearrangements.clear();
-
-        if (skipPlacement && !d->pendingPlacements.isEmpty())
-            d->pendingPlacements.clear();
-    }
-
-    if (!d->pendingPlacements.isEmpty()) {
-        foreach (QMdiSubWindow *window, d->pendingPlacements) {
-            if (!window)
-                continue;
-            if (!window->testAttribute(Qt::WA_Resized)) {
-                QSize newSize(window->sizeHint().boundedTo(viewport()->size()));
-                window->resize(newSize.expandedTo(qSmartMinSize(window)));
-            }
-            if (!window->testAttribute(Qt::WA_Moved) && !window->isMinimized()
-                    && !window->isMaximized()) {
-                d->place(d->placer, window);
-            }
-        }
-        d->pendingPlacements.clear();
-    }
-
-    d->setChildActivationEnabled(true);
-    d->activateCurrentWindow();
-
-    QAbstractScrollArea::showEvent(showEvent);
-}
-
-/*!
-    \reimp
-*/
-bool QMdiArea::viewportEvent(QEvent *event)
-{
-    Q_D(QMdiArea);
-    switch (event->type()) {
-    case QEvent::ChildRemoved: {
-        d->isSubWindowsTiled = false;
-        QObject *removedChild = static_cast<QChildEvent *>(event)->child();
-        for (int i = 0; i < d->childWindows.size(); ++i) {
-            QObject *child = d->childWindows.at(i);
-            if (!child || child == removedChild || !child->parent()
-                    || child->parent() != viewport()) {
-                if (!testOption(DontMaximizeSubWindowOnActivation)) {
-                    // In this case we can only rely on the child being a QObject
-                    // (or 0), but let's try and see if we can get more information.
-                    QWidget *mdiChild = qobject_cast<QWidget *>(removedChild);
-                    if (mdiChild && mdiChild->isMaximized())
-                        d->showActiveWindowMaximized = true;
-                }
-                d->disconnectSubWindow(child);
-                const bool activeRemoved = i == d->indicesToActivatedChildren.at(0);
-                d->childWindows.removeAt(i);
-                d->indicesToActivatedChildren.removeAll(i);
-                d->updateActiveWindow(i, activeRemoved);
-                d->arrangeMinimizedSubWindows();
-                break;
-            }
-        }
-        d->updateScrollBars();
-        break;
-    }
-    case QEvent::Destroy:
-        d->isSubWindowsTiled = false;
-        d->resetActiveWindow();
-        d->childWindows.clear();
-        qWarning("QMdiArea: Deleting the view port is undefined, use setViewport instead.");
-        break;
-    default:
-        break;
-    }
-    return QAbstractScrollArea::viewportEvent(event);
-}
-
-/*!
-    \reimp
-*/
-void QMdiArea::scrollContentsBy(int dx, int dy)
-{
-    Q_D(QMdiArea);
-    const bool wasSubWindowsTiled = d->isSubWindowsTiled;
-    d->ignoreGeometryChange = true;
-    viewport()->scroll(isLeftToRight() ? dx : -dx, dy);
-    d->arrangeMinimizedSubWindows();
-    d->ignoreGeometryChange = false;
-    if (wasSubWindowsTiled)
-        d->isSubWindowsTiled = true;
-}
-
-/*!
-    Arranges all child windows in a tile pattern.
-
-    \sa cascadeSubWindows()
-*/
-void QMdiArea::tileSubWindows()
-{
-    Q_D(QMdiArea);
-    if (!d->regularTiler)
-        d->regularTiler = new RegularTiler;
-    d->rearrange(d->regularTiler);
-}
-
-/*!
-    Arranges all the child windows in a cascade pattern.
-
-    \sa tileSubWindows()
-*/
-void QMdiArea::cascadeSubWindows()
-{
-    Q_D(QMdiArea);
-    if (!d->cascader)
-        d->cascader = new SimpleCascader;
-    d->rearrange(d->cascader);
-}
-
-/*!
-    \reimp
-*/
-bool QMdiArea::event(QEvent *event)
-{
-    Q_D(QMdiArea);
-    switch (event->type()) {
-    case QEvent::WindowActivate: {
-        d->isActivated = true;
-        if (d->childWindows.isEmpty())
-            break;
-        if (!d->active)
-            d->activateCurrentWindow();
-        d->setChildActivationEnabled(false, true);
-        break;
-    }
-    case QEvent::WindowDeactivate:
-        d->isActivated = false;
-        d->setChildActivationEnabled(false, true);
-        break;
-    case QEvent::StyleChange:
-        // Re-tile the views if we're in tiled mode. Re-tile means we will change
-        // the geometry of the children, which in turn means 'isSubWindowsTiled'
-        // is set to false, so we have to update the state at the end.
-        if (d->isSubWindowsTiled) {
-            tileSubWindows();
-            d->isSubWindowsTiled = true;
-        }
-        break;
-    case QEvent::WindowIconChange:
-        foreach (QMdiSubWindow *window, d->childWindows) {
-            if (sanityCheck(window, "QMdiArea::WindowIconChange"))
-                QApplication::sendEvent(window, event);
-        }
-        break;
-    case QEvent::Hide:
-        d->setActive(d->active, false, false);
-        d->setChildActivationEnabled(false);
-        break;
-#ifndef QT_NO_TABBAR
-    case QEvent::LayoutDirectionChange:
-        d->updateTabBarGeometry();
-        break;
-#endif
-    default:
-        break;
-    }
-    return QAbstractScrollArea::event(event);
-}
-
-/*!
-    \reimp
-*/
-bool QMdiArea::eventFilter(QObject *object, QEvent *event)
-{
-    if (!object)
-        return QAbstractScrollArea::eventFilter(object, event);
-
-    Q_D(QMdiArea);
-    // Global key events with Ctrl modifier.
-    if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
-
-        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
-        // Ingore key events without a Ctrl modifier (except for press/release on the modifier itself).
-        if (!(keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() != Qt::Key_Control)
-            return QAbstractScrollArea::eventFilter(object, event);
-
-        // Find closest mdi area (in case we have a nested workspace).
-        QMdiArea *area = mdiAreaParent(static_cast<QWidget *>(object));
-        if (!area)
-            return QAbstractScrollArea::eventFilter(object, event);
-
-        const bool keyPress = (event->type() == QEvent::KeyPress);
-
-        // 1) Ctrl-Tab once -> activate the previously active window.
-        // 2) Ctrl-Tab (Tab, Tab, ...) -> iterate through all windows (activateNextSubWindow()).
-        // 3) Ctrl-Shift-Tab (Tab, Tab, ...) -> iterate through all windows in the opposite
-        //    direction (activatePreviousSubWindow())
-        switch (keyEvent->key()) {
-        case Qt::Key_Control:
-            if (keyPress)
-                area->d_func()->startTabToPreviousTimer();
-            else
-                area->d_func()->activateHighlightedWindow();
-            break;
-        case Qt::Key_Tab:
-        case Qt::Key_Backtab:
-            if (keyPress)
-                area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1);
-            return true;
-#ifndef QT_NO_RUBBERBAND
-        case Qt::Key_Escape:
-            area->d_func()->hideRubberBand();
-            break;
-#endif
-        default:
-            break;
-        }
-        return QAbstractScrollArea::eventFilter(object, event);
-    }
-
-    QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>(object);
-
-    if (!subWindow) {
-        // QApplication events:
-        if (event->type() == QEvent::ApplicationActivate && !d->active
-            && isVisible() && !window()->isMinimized()) {
-            d->activateCurrentWindow();
-        } else if (event->type() == QEvent::ApplicationDeactivate && d->active) {
-            d->setActive(d->active, false, false);
-        }
-        return QAbstractScrollArea::eventFilter(object, event);
-    }
-
-    if (subWindow->mdiArea() != this)
-        return QAbstractScrollArea::eventFilter(object, event);
-
-    // QMdiSubWindow events:
-    switch (event->type()) {
-    case QEvent::Move:
-    case QEvent::Resize:
-        if (d->tileCalledFromResizeEvent)
-            break;
-        d->updateScrollBars();
-        if (!subWindow->isMinimized())
-            d->isSubWindowsTiled = false;
-        break;
-    case QEvent::Show:
-#ifndef QT_NO_TABBAR
-        if (d->tabBar) {
-            const int tabIndex = d->childWindows.indexOf(subWindow);
-            if (!d->tabBar->isTabEnabled(tabIndex))
-                d->tabBar->setTabEnabled(tabIndex, true);
-        }
-#endif // QT_NO_TABBAR
-        // fall through
-    case QEvent::Hide:
-        d->isSubWindowsTiled = false;
-        break;
-#ifndef QT_NO_RUBBERBAND
-    case QEvent::Close:
-        if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted)
-            d->hideRubberBand();
-        break;
-#endif
-#ifndef QT_NO_TABBAR
-    case QEvent::WindowTitleChange:
-    case QEvent::ModifiedChange:
-        if (d->tabBar)
-            d->tabBar->setTabText(d->childWindows.indexOf(subWindow), tabTextFor(subWindow));
-        break;
-    case QEvent::WindowIconChange:
-        if (d->tabBar)
-            d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon());
-        break;
-#endif // QT_NO_TABBAR
-    default:
-        break;
-    }
-    return QAbstractScrollArea::eventFilter(object, event);
-}
-
-/*!
-    \reimp
-*/
-void QMdiArea::paintEvent(QPaintEvent *paintEvent)
-{
-    Q_D(QMdiArea);
-    QPainter painter(d->viewport);
-    const QVector<QRect> &exposedRects = paintEvent->region().rects();
-    for (int i = 0; i < exposedRects.size(); ++i)
-        painter.fillRect(exposedRects.at(i), d->background);
-}
-
-/*!
-    This slot is called by QAbstractScrollArea after setViewport() has been
-    called. Reimplement this function in a subclass of QMdiArea to
-    initialize the new \a viewport before it is used.
-
-    \sa setViewport()
-*/
-void QMdiArea::setupViewport(QWidget *viewport)
-{
-    Q_D(QMdiArea);
-    if (viewport)
-        viewport->setAttribute(Qt::WA_OpaquePaintEvent, d->background.isOpaque());
-    foreach (QMdiSubWindow *child, d->childWindows) {
-        if (!sanityCheck(child, "QMdiArea::setupViewport"))
-            continue;
-        child->setParent(viewport, child->windowFlags());
-    }
-}
-
-QT_END_NAMESPACE
-
-
-#include "moc_qmdiarea.h"
-
-#endif // QT_NO_MDIAREA
-
-
diff --git a/src/gui/widgets/qmdiarea.h b/src/gui/widgets/qmdiarea.h
deleted file mode 100644 (file)
index bd1a540..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMDIAREA_H
-#define QMDIAREA_H
-
-#include <QtGui/qabstractscrollarea.h>
-#include <QtGui/qtabwidget.h>
-
-#ifndef QT_NO_MDIAREA
-
-QT_BEGIN_NAMESPACE
-
-class QMdiSubWindow;
-
-class QMdiAreaPrivate;
-class Q_GUI_EXPORT QMdiArea : public QAbstractScrollArea
-{
-    Q_OBJECT
-    Q_ENUMS(ViewMode)
-    Q_PROPERTY(QBrush background READ background WRITE setBackground)
-    Q_PROPERTY(WindowOrder activationOrder READ activationOrder WRITE setActivationOrder)
-    Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode)
-#ifndef QT_NO_TABBAR
-    Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
-    Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable)
-    Q_PROPERTY(bool tabsMovable READ tabsMovable WRITE setTabsMovable)
-#endif
-#ifndef QT_NO_TABWIDGET
-    Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape)
-    Q_PROPERTY(QTabWidget::TabPosition tabPosition READ tabPosition WRITE setTabPosition)
-#endif
-    Q_ENUMS(WindowOrder)
-public:
-    enum AreaOption {
-        DontMaximizeSubWindowOnActivation = 0x1
-    };
-    Q_DECLARE_FLAGS(AreaOptions, AreaOption)
-
-    enum WindowOrder {
-        CreationOrder,
-        StackingOrder,
-        ActivationHistoryOrder
-    };
-
-    enum ViewMode {
-        SubWindowView,
-        TabbedView
-    };
-
-    QMdiArea(QWidget *parent = nullptr);
-    ~QMdiArea();
-
-    QSize sizeHint() const;
-    QSize minimumSizeHint() const;
-
-    QMdiSubWindow *currentSubWindow() const;
-    QMdiSubWindow *activeSubWindow() const;
-    QList<QMdiSubWindow *> subWindowList(WindowOrder order = CreationOrder) const;
-
-    QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags flags = 0);
-    void removeSubWindow(QWidget *widget);
-
-    QBrush background() const;
-    void setBackground(const QBrush &background);
-
-    WindowOrder activationOrder() const;
-    void setActivationOrder(WindowOrder order);
-
-    void setOption(AreaOption option, bool on = true);
-    bool testOption(AreaOption opton) const;
-
-    void setViewMode(ViewMode mode);
-    ViewMode viewMode() const;
-
-#ifndef QT_NO_TABBAR
-    bool documentMode() const;
-    void setDocumentMode(bool enabled);
-
-    void setTabsClosable(bool closable);
-    bool tabsClosable() const;
-
-    void setTabsMovable(bool movable);
-    bool tabsMovable() const;
-#endif
-#ifndef QT_NO_TABWIDGET
-    void setTabShape(QTabWidget::TabShape shape);
-    QTabWidget::TabShape tabShape() const;
-
-    void setTabPosition(QTabWidget::TabPosition position);
-    QTabWidget::TabPosition tabPosition() const;
-#endif
-
-Q_SIGNALS:
-    void subWindowActivated(QMdiSubWindow *);
-
-public Q_SLOTS:
-    void setActiveSubWindow(QMdiSubWindow *window);
-    void tileSubWindows();
-    void cascadeSubWindows();
-    void closeActiveSubWindow();
-    void closeAllSubWindows();
-    void activateNextSubWindow();
-    void activatePreviousSubWindow();
-
-protected Q_SLOTS:
-    void setupViewport(QWidget *viewport);
-
-protected:
-    bool event(QEvent *event);
-    bool eventFilter(QObject *object, QEvent *event);
-    void paintEvent(QPaintEvent *paintEvent);
-    void childEvent(QChildEvent *childEvent);
-    void resizeEvent(QResizeEvent *resizeEvent);
-    void timerEvent(QTimerEvent *timerEvent);
-    void showEvent(QShowEvent *showEvent);
-    bool viewportEvent(QEvent *event);
-    void scrollContentsBy(int dx, int dy);
-
-private:
-    Q_DISABLE_COPY(QMdiArea)
-    Q_DECLARE_PRIVATE(QMdiArea)
-    Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows())
-    Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates))
-    Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int))
-    Q_PRIVATE_SLOT(d_func(), void _q_closeTab(int))
-    Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int, int))
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiArea::AreaOptions)
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_MDIAREA
-
-#endif // QMDIAREA_H
diff --git a/src/gui/widgets/qmdiarea_p.h b/src/gui/widgets/qmdiarea_p.h
deleted file mode 100644 (file)
index e05f305..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMDIAREA_P_H
-#define QMDIAREA_P_H
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the Katie API.  It exists purely as an
-// implementation detail.  This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qmdiarea.h"
-#include "qmdisubwindow.h"
-
-#ifndef QT_NO_MDIAREA
-
-#include <QList>
-#include <QRect>
-#include <QPoint>
-#include <QtGui/qapplication.h>
-#include "qmdisubwindow_p.h"
-#include "qabstractscrollarea_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QMdi {
-class Rearranger
-{
-public:
-    enum Type {
-        RegularTiler,
-        SimpleCascader,
-        IconTiler
-    };
-
-    // Rearranges widgets relative to domain.
-    virtual void rearrange(QList<QWidget *> &widgets, const QRect &domain) const = 0;
-    virtual Type type() const = 0;
-    virtual ~Rearranger() {}
-};
-
-class RegularTiler : public Rearranger
-{
-    // Rearranges widgets according to a regular tiling pattern
-    // covering the entire domain.
-    // Both positions and sizes may change.
-    void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
-    inline Type type() const { return Rearranger::RegularTiler; }
-};
-
-class SimpleCascader : public Rearranger
-{
-    // Rearranges widgets according to a simple, regular cascading pattern.
-    // Widgets are resized to minimumSize.
-    // Both positions and sizes may change.
-    void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
-    inline Type type() const { return Rearranger::SimpleCascader; }
-};
-
-class IconTiler : public Rearranger
-{
-    // Rearranges icons (assumed to be the same size) according to a regular
-    // tiling pattern filling up the domain from the bottom.
-    // Only positions may change.
-    void rearrange(QList<QWidget *> &widgets, const QRect &domain) const;
-    inline Type type() const { return Rearranger::IconTiler; }
-};
-
-class Placer
-{
-public:
-    // Places the rectangle defined by 'size' relative to 'rects' and 'domain'.
-    // Returns the position of the resulting rectangle.
-    virtual QPoint place(
-        const QSize &size, const QList<QRect> &rects, const QRect &domain) const = 0;
-    virtual ~Placer() {}
-};
-
-class MinOverlapPlacer : public Placer
-{
-    QPoint place(const QSize &size, const QList<QRect> &rects, const QRect &domain) const;
-    static int accumulatedOverlap(const QRect &source, const QList<QRect> &rects);
-    static QRect findMinOverlapRect(const QList<QRect> &source, const QList<QRect> &rects);
-    static void getCandidatePlacements(
-        const QSize &size, const QList<QRect> &rects, const QRect &domain,
-        QList<QRect> &candidates);
-    static QPoint findBestPlacement(
-        const QRect &domain, const QList<QRect> &rects, QList<QRect> &source);
-    static void findNonInsiders(
-        const QRect &domain, QList<QRect> &source, QList<QRect> &result);
-    static void findMaxOverlappers(
-        const QRect &domain, const QList<QRect> &source, QList<QRect> &result);
-};
-} // namespace QMdi
-
-class QMdiAreaTabBar;
-class QMdiAreaPrivate : public QAbstractScrollAreaPrivate
-{
-    Q_DECLARE_PUBLIC(QMdiArea)
-public:
-    QMdiAreaPrivate();
-
-    // Variables.
-    QMdi::Rearranger *cascader;
-    QMdi::Rearranger *regularTiler;
-    QMdi::Rearranger *iconTiler;
-    QMdi::Placer *placer;
-#ifndef QT_NO_RUBBERBAND
-    QRubberBand *rubberBand;
-#endif
-    QMdiAreaTabBar *tabBar;
-    QList<QMdi::Rearranger *> pendingRearrangements;
-    QList< QPointer<QMdiSubWindow> > pendingPlacements;
-    QList< QPointer<QMdiSubWindow> > childWindows;
-    QList<int> indicesToActivatedChildren;
-    QPointer<QMdiSubWindow> active;
-    QPointer<QMdiSubWindow> aboutToBecomeActive;
-    QBrush background;
-    QMdiArea::WindowOrder activationOrder;
-    QMdiArea::AreaOptions options;
-    QMdiArea::ViewMode viewMode;
-#ifndef QT_NO_TABBAR
-    bool documentMode;
-    bool tabsClosable;
-    bool tabsMovable;
-#endif
-#ifndef QT_NO_TABWIDGET
-    QTabWidget::TabShape tabShape;
-    QTabWidget::TabPosition tabPosition;
-#endif
-    bool ignoreGeometryChange;
-    bool ignoreWindowStateChange;
-    bool isActivated;
-    bool isSubWindowsTiled;
-    bool showActiveWindowMaximized;
-    bool tileCalledFromResizeEvent;
-    bool updatesDisabledByUs;
-    bool inViewModeChange;
-    int indexToNextWindow;
-    int indexToPreviousWindow;
-    int indexToHighlighted;
-    int indexToLastActiveTab;
-    int resizeTimerId;
-    int tabToPreviousTimerId;
-
-    // Slots.
-    void _q_deactivateAllWindows(QMdiSubWindow *aboutToActivate = 0);
-    void _q_processWindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
-    void _q_currentTabChanged(int index);
-    void _q_closeTab(int index);
-    void _q_moveTab(int from, int to);
-
-    // Functions.
-    void appendChild(QMdiSubWindow *child);
-    void place(QMdi::Placer *placer, QMdiSubWindow *child);
-    void rearrange(QMdi::Rearranger *rearranger);
-    void arrangeMinimizedSubWindows();
-    void activateWindow(QMdiSubWindow *child);
-    void activateCurrentWindow();
-    void activateHighlightedWindow();
-    void emitWindowActivated(QMdiSubWindow *child);
-    void resetActiveWindow(QMdiSubWindow *child = 0);
-    void updateActiveWindow(int removedIndex, bool activeRemoved);
-    void updateScrollBars();
-    void internalRaise(QMdiSubWindow *child) const;
-    bool scrollBarsEnabled() const;
-    bool lastWindowAboutToBeDestroyed() const;
-    void setChildActivationEnabled(bool enable = true, bool onlyNextActivationEvent = false) const;
-    QRect resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount);
-    void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy); // reimp
-    QMdiSubWindow *nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder,
-                                        int removed = -1, int fromIndex = -1) const;
-    void highlightNextSubWindow(int increaseFactor);
-    QList<QMdiSubWindow *> subWindowList(QMdiArea::WindowOrder, bool reversed = false) const;
-    void disconnectSubWindow(QObject *subWindow);
-    void setViewMode(QMdiArea::ViewMode mode);
-#ifndef QT_NO_TABBAR
-    void updateTabBarGeometry();
-    void refreshTabBar();
-#endif
-
-    inline void startResizeTimer()
-    {
-        Q_Q(QMdiArea);
-        if (resizeTimerId > 0)
-            q->killTimer(resizeTimerId);
-        resizeTimerId = q->startTimer(200);
-    }
-
-    inline void startTabToPreviousTimer()
-    {
-        Q_Q(QMdiArea);
-        if (tabToPreviousTimerId > 0)
-            q->killTimer(tabToPreviousTimerId);
-        tabToPreviousTimerId = q->startTimer(QApplication::keyboardInputInterval());
-    }
-
-    inline bool windowStaysOnTop(QMdiSubWindow *subWindow) const
-    {
-        if (!subWindow)
-            return false;
-        return subWindow->windowFlags() & Qt::WindowStaysOnTopHint;
-    }
-
-    inline bool isExplicitlyDeactivated(QMdiSubWindow *subWindow) const
-    {
-        if (!subWindow)
-            return true;
-        return subWindow->d_func()->isExplicitlyDeactivated;
-    }
-
-    inline void setActive(QMdiSubWindow *subWindow, bool active = true, bool changeFocus = true) const
-    {
-        if (subWindow)
-            subWindow->d_func()->setActive(active, changeFocus);
-    }
-
-#ifndef QT_NO_RUBBERBAND
-    inline void showRubberBandFor(QMdiSubWindow *subWindow)
-    {
-        if (!subWindow || !rubberBand)
-            return;
-        rubberBand->setGeometry(subWindow->geometry());
-        rubberBand->raise();
-        rubberBand->show();
-    }
-
-    inline void hideRubberBand()
-    {
-        if (rubberBand && rubberBand->isVisible())
-            rubberBand->hide();
-        indexToHighlighted = -1;
-    }
-#endif // QT_NO_RUBBERBAND
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_MDIAREA
-
-#endif // QMDIAREA_P_H
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
deleted file mode 100644 (file)
index d992954..0000000
+++ /dev/null
@@ -1,3399 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-    \class QMdiSubWindow
-    \brief The QMdiSubWindow class provides a subwindow class for
-    QMdiArea.
-    \since 4.3
-    \ingroup mainwindow-classes
-
-
-    QMdiSubWindow represents a top-level window in a QMdiArea, and consists
-    of a title bar with window decorations, an internal widget, and
-    (depending on the current style) a window frame and a size
-    grip. QMdiSubWindow has its own layout, which consists of the
-    title bar and a center area for the internal widget.
-
-    \image qmdisubwindowlayout.png
-
-    The most common way to construct a QMdiSubWindow is to call
-    QMdiArea::addSubWindow() with the internal widget as the argument.
-    You can also create a subwindow yourself, and set an internal
-    widget by calling setWidget().
-
-    You use the same API when programming with subwindows as with
-    regular top-level windows (e.g., you can call functions such as
-    show(), hide(), showMaximized(), and setWindowTitle()).
-
-    \section1 Subwindow Handling
-
-    QMdiSubWindow also supports behavior specific to subwindows in
-    an MDI area.
-
-    By default, each QMdiSubWindow is visible inside the MDI area
-    viewport when moved around, but it is also possible to specify
-    transparent window movement and resizing behavior, where only
-    the outline of a subwindow is updated during these operations.
-    The setOption() function is used to enable this behavior.
-
-    The isShaded() function detects whether the subwindow is
-    currently shaded (i.e., the window is collapsed so that only the
-    title bar is visible). To enter shaded mode, call showShaded().
-    QMdiSubWindow emits the windowStateChanged() signal whenever the
-    window state has changed (e.g., when the window becomes minimized,
-    or is restored). It also emits aboutToActivate() before it is
-    activated.
-
-    In keyboard-interactive mode, the windows are moved and resized
-    with the keyboard. You can enter this mode through the system menu
-    of the window. The keyboardSingleStep and keyboardPageStep
-    properties control the distance the widget is moved or resized for
-    each keypress event. When shift is pressed down page step is used;
-    otherwise single step is used.
-
-    You can also change the active window with the keyboard. By
-    pressing the control and tab keys at the same time, the next
-    (using the current \l{QMdiArea::}{WindowOrder}) subwindow will be
-    activated. By pressing control, shift, and tab, you will activate
-    the previous window. This is equivalent to calling
-    \l{QMdiArea::}{activateNextSubWindow()} and
-    \l{QMdiArea::}{activatePreviousSubWindow()}. Note that these
-    shortcuts overrides global shortcuts, but not the \l{QMdiArea}s
-    shortcuts.
-
-    \sa QMdiArea
-*/
-
-/*!
-    \enum QMdiSubWindow::SubWindowOption
-
-    This enum describes options that customize the behavior
-    of QMdiSubWindow.
-
-    \omitvalue AllowOutsideAreaHorizontally
-    \omitvalue AllowOutsideAreaVertically
-
-    \value RubberBandResize If you enable this option, a rubber band
-    control is used to represent the subwindow's outline, and the user
-    resizes this instead of the subwindow itself.
-    As a result, the subwindow maintains its original position and size
-    until the resize operation has been completed, at which time it will
-    receive a single QResizeEvent.
-    By default, this option is disabled.
-
-    \value RubberBandMove If you enable this option, a rubber band
-    control is used to represent the subwindow's outline, and the user
-    moves this instead of the subwindow itself.
-    As a result, the subwindow remains in its original position until
-    the move operation has completed, at which time a QMoveEvent is
-    sent to the window. By default, this option is disabled.
-*/
-
-/*!
-    \fn QMdiSubWindow::windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
-
-    QMdiSubWindow emits this signal after the window state changes. \a
-    oldState is the window state before it changed, and \a newState is the
-    new, current state.
-*/
-
-/*!
-    \fn QMdiSubWindow::aboutToActivate()
-
-    QMdiSubWindow emits this signal immediately before it is
-    activated. After the subwindow has been activated, the QMdiArea that
-    manages the subwindow will also emit the
-    \l{QMdiArea::}{subWindowActivated()} signal.
-
-    \sa QMdiArea::subWindowActivated()
-*/
-
-#include "qmdisubwindow_p.h"
-
-#ifndef QT_NO_MDIAREA
-
-#include <QApplication>
-#include <QStylePainter>
-#include <QVBoxLayout>
-#include <QEvent>
-#include <QWhatsThis>
-#include <QToolTip>
-#include <QMainWindow>
-#include <QScrollBar>
-#include <QDebug>
-#include <QScopedValueRollback>
-#include <QMdiArea>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QMdi;
-
-static const QStyle::SubControl SubControls[] =
-{
-    QStyle::SC_TitleBarLabel, // 1
-    QStyle::SC_TitleBarSysMenu, // 2
-    QStyle::SC_TitleBarMinButton, // 3
-    QStyle::SC_TitleBarMaxButton, // 4
-    QStyle::SC_TitleBarShadeButton, // 5
-    QStyle::SC_TitleBarCloseButton, // 6
-    QStyle::SC_TitleBarNormalButton, // 7
-    QStyle::SC_TitleBarUnshadeButton, // 8
-    QStyle::SC_TitleBarContextHelpButton // 9
-};
-static const int NumSubControls = sizeof(SubControls) / sizeof(SubControls[0]);
-
-static const Qt::WindowFlags CustomizeWindowFlags =
-      Qt::FramelessWindowHint
-    | Qt::CustomizeWindowHint
-    | Qt::WindowTitleHint
-    | Qt::WindowSystemMenuHint
-    | Qt::WindowMinimizeButtonHint
-    | Qt::WindowMaximizeButtonHint
-    | Qt::WindowMinMaxButtonsHint;
-
-
-static const int BoundaryMargin = 5;
-
-static inline int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag,
-                                        int delta, int maxDelta, int minDelta)
-{
-    if (cflags & moveFlag) {
-        if (delta > 0)
-            return (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta;
-        return (cflags & resizeFlag) ? qMax(delta, minDelta) : delta;
-    }
-    return 0;
-}
-
-static inline int getResizeDeltaComponent(uint cflags, uint resizeFlag,
-                                          uint resizeReverseFlag, int delta)
-{
-    if (cflags & resizeFlag) {
-        if (cflags & resizeReverseFlag)
-            return -delta;
-        return delta;
-    }
-    return 0;
-}
-
-static inline bool isChildOfQMdiSubWindow(const QWidget *child)
-{
-    Q_ASSERT(child);
-    QWidget *parent = child->parentWidget();
-    while (parent) {
-        if (qobject_cast<QMdiSubWindow *>(parent))
-            return true;
-        parent = parent->parentWidget();
-    }
-    return false;
-}
-
-static inline bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child)
-{
-    Q_ASSERT(child);
-    if (QMdiArea *mdiArea = child->mdiArea()) {
-        if (mdiArea->viewMode() == QMdiArea::TabbedView)
-            return true;
-    }
-    return false;
-}
-
-template<typename T>
-static inline ControlElement<T> *ptr(QWidget *widget)
-{
-    if (widget && widget->qt_metacast("ControlElement")
-            && strcmp(widget->metaObject()->className(), T::staticMetaObject.className()) == 0) {
-        return static_cast<ControlElement<T> *>(widget);
-    }
-    return 0;
-}
-
-QString QMdiSubWindowPrivate::originalWindowTitle()
-{
-    Q_Q(QMdiSubWindow);
-    if (originalTitle.isNull()) {
-        originalTitle = q->window()->windowTitle();
-        if (originalTitle.isNull())
-            originalTitle = QLatin1String("");
-    }
-    return originalTitle;
-}
-
-void QMdiSubWindowPrivate::setNewWindowTitle()
-{
-    Q_Q(QMdiSubWindow);
-    QString childTitle = q->windowTitle();
-    if (childTitle.isEmpty())
-        return;
-    QString original = originalWindowTitle();
-    if (!original.isEmpty()) {
-        if (!original.contains(QMdiSubWindow::tr("- [%1]").arg(childTitle)))
-            q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle));
-
-    } else {
-        q->window()->setWindowTitle(childTitle);
-    }
-}
-
-static inline bool isHoverControl(QStyle::SubControl control)
-{
-    return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel;
-}
-
-#ifndef QT_NO_TOOLTIP
-static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt,
-                        QStyle::ComplexControl complexControl, QStyle::SubControl subControl)
-{
-    Q_ASSERT(helpEvent);
-    Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
-    Q_ASSERT(widget);
-
-    // Convert CC_MdiControls to CC_TitleBar. Sub controls of different complex
-    // controls cannot be in the same switch as they might have the same value.
-    if (complexControl == QStyle::CC_MdiControls) {
-        if (subControl == QStyle::SC_MdiMinButton)
-            subControl = QStyle::SC_TitleBarMinButton;
-        else if (subControl == QStyle::SC_MdiCloseButton)
-            subControl = QStyle::SC_TitleBarCloseButton;
-        else if (subControl == QStyle::SC_MdiNormalButton)
-            subControl = QStyle::SC_TitleBarNormalButton;
-        else
-            subControl = QStyle::SC_None;
-    }
-
-    // Don't change the tooltip for the base widget itself.
-    if (subControl == QStyle::SC_None)
-        return;
-
-    QString toolTip;
-
-    switch (subControl) {
-    case QStyle::SC_TitleBarMinButton:
-        toolTip = QMdiSubWindow::tr("Minimize");
-        break;
-    case QStyle::SC_TitleBarMaxButton:
-        toolTip = QMdiSubWindow::tr("Maximize");
-        break;
-    case QStyle::SC_TitleBarUnshadeButton:
-        toolTip = QMdiSubWindow::tr("Unshade");
-        break;
-    case QStyle::SC_TitleBarShadeButton:
-        toolTip = QMdiSubWindow::tr("Shade");
-        break;
-    case QStyle::SC_TitleBarNormalButton:
-        if (widget->isMaximized() || !qobject_cast<QMdiSubWindow *>(widget))
-            toolTip = QMdiSubWindow::tr("Restore Down");
-        else
-            toolTip = QMdiSubWindow::tr("Restore");
-        break;
-    case QStyle::SC_TitleBarCloseButton:
-        toolTip = QMdiSubWindow::tr("Close");
-        break;
-    case QStyle::SC_TitleBarContextHelpButton:
-        toolTip = QMdiSubWindow::tr("Help");
-        break;
-    case QStyle::SC_TitleBarSysMenu:
-        toolTip = QMdiSubWindow::tr("Menu");
-        break;
-    default:
-        break;
-    }
-
-    const QRect rect = widget->style()->subControlRect(complexControl, &opt, subControl, widget);
-    QToolTip::showText(helpEvent->globalPos(), toolTip, widget, rect);
-}
-#endif // QT_NO_TOOLTIP
-
-namespace QMdi {
-/*
-    \class ControlLabel
-    \internal
-*/
-class ControlLabel : public QWidget
-{
-    Q_OBJECT
-public:
-    ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = nullptr);
-
-    QSize sizeHint() const;
-
-signals:
-    void _q_clicked();
-    void _q_doubleClicked();
-
-protected:
-    bool event(QEvent *event);
-    void paintEvent(QPaintEvent *paintEvent);
-    void mousePressEvent(QMouseEvent *mouseEvent);
-    void mouseDoubleClickEvent(QMouseEvent *mouseEvent);
-    void mouseReleaseEvent(QMouseEvent *mouseEvent);
-
-private:
-    QPixmap label;
-    bool isPressed;
-    void updateWindowIcon();
-};
-} // namespace QMdi
-
-ControlLabel::ControlLabel(QMdiSubWindow *subWindow, QWidget *parent)
-    : QWidget(parent), isPressed(false)
-{
-    Q_UNUSED(subWindow);
-    setFocusPolicy(Qt::NoFocus);
-    updateWindowIcon();
-    setFixedSize(label.size());
-}
-
-/*
-    \internal
-*/
-QSize ControlLabel::sizeHint() const
-{
-    return label.size();
-}
-
-/*
-    \internal
-*/
-bool ControlLabel::event(QEvent *event)
-{
-    if (event->type() == QEvent::WindowIconChange)
-        updateWindowIcon();
-#ifndef QT_NO_TOOLTIP
-    else if (event->type() == QEvent::ToolTip) {
-        QStyleOptionTitleBar options;
-        options.initFrom(this);
-        showToolTip(static_cast<QHelpEvent *>(event), this, options,
-                    QStyle::CC_TitleBar, QStyle::SC_TitleBarSysMenu);
-    }
-#endif
-    return QWidget::event(event);
-}
-
-/*
-    \internal
-*/
-void ControlLabel::paintEvent(QPaintEvent * /*paintEvent*/)
-{
-    QPainter painter(this);
-    painter.drawPixmap(0, 0, label);
-}
-
-/*
-    \internal
-*/
-void ControlLabel::mousePressEvent(QMouseEvent *mouseEvent)
-{
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-    isPressed = true;
-}
-
-/*
-    \internal
-*/
-void ControlLabel::mouseDoubleClickEvent(QMouseEvent *mouseEvent)
-{
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-    isPressed = false;
-    emit _q_doubleClicked();
-}
-
-/*
-    \internal
-*/
-void ControlLabel::mouseReleaseEvent(QMouseEvent *mouseEvent)
-{
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-    if (isPressed) {
-        isPressed = false;
-        emit _q_clicked();
-    }
-}
-
-/*
-    \internal
-*/
-void ControlLabel::updateWindowIcon()
-{
-    QIcon menuIcon = windowIcon();
-    if (menuIcon.isNull())
-        menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget());
-    label = menuIcon.pixmap(16, 16);
-    update();
-}
-
-namespace QMdi {
-/*
-    \class ControllerWidget
-    \internal
-*/
-class ControllerWidget : public QWidget
-{
-    Q_OBJECT
-public:
-    ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = nullptr);
-    QSize sizeHint() const;
-    void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible);
-    inline bool hasVisibleControls() const
-    {
-        return (visibleControls & QStyle::SC_MdiMinButton)
-               || (visibleControls & QStyle::SC_MdiNormalButton)
-               || (visibleControls & QStyle::SC_MdiCloseButton);
-    }
-
-signals:
-    void _q_minimize();
-    void _q_restore();
-    void _q_close();
-
-protected:
-    void paintEvent(QPaintEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    void mouseReleaseEvent(QMouseEvent *event);
-    void mouseMoveEvent(QMouseEvent *event);
-    void leaveEvent(QEvent *event);
-    bool event(QEvent *event);
-
-private:
-    QStyle::SubControl activeControl;
-    QStyle::SubControl hoverControl;
-    QStyle::SubControls visibleControls;
-    void initStyleOption(QStyleOptionComplex *option) const;
-    QMdiArea *mdiArea;
-    inline QStyle::SubControl getSubControl(const QPoint &pos) const
-    {
-        QStyleOptionComplex opt;
-        initStyleOption(&opt);
-        return style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea);
-    }
-};
-} // namespace QMdi
-
-/*
-    \internal
-*/
-ControllerWidget::ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent)
-    : QWidget(parent),
-      activeControl(QStyle::SC_None),
-      hoverControl(QStyle::SC_None),
-      visibleControls(QStyle::SC_None),
-      mdiArea(0)
-{
-    if (subWindow->parentWidget())
-        mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget());
-    setFocusPolicy(Qt::NoFocus);
-    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-    setMouseTracking(true);
-}
-
-/*
-    \internal
-*/
-QSize ControllerWidget::sizeHint() const
-{
-    ensurePolished();
-    QStyleOptionComplex opt;
-    initStyleOption(&opt);
-    QSize size(48, 16);
-    return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea);
-}
-
-void ControllerWidget::setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible)
-{
-    QStyle::SubControl subControl = QStyle::SC_None;
-
-    // Map action from QMdiSubWindowPrivate::WindowStateAction to QStyle::SubControl.
-    if (action == QMdiSubWindowPrivate::MaximizeAction)
-        subControl = QStyle::SC_MdiNormalButton;
-    else if (action == QMdiSubWindowPrivate::CloseAction)
-        subControl = QStyle::SC_MdiCloseButton;
-    else if (action == QMdiSubWindowPrivate::MinimizeAction)
-        subControl = QStyle::SC_MdiMinButton;
-
-    if (subControl == QStyle::SC_None)
-        return;
-
-    if (visible && !(visibleControls & subControl))
-        visibleControls |= subControl;
-    else if (!visible && (visibleControls & subControl))
-        visibleControls &= ~subControl;
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::paintEvent(QPaintEvent * /*paintEvent*/)
-{
-    QStyleOptionComplex opt;
-    initStyleOption(&opt);
-    if (activeControl == hoverControl) {
-        opt.activeSubControls = activeControl;
-        opt.state |= QStyle::State_Sunken;
-    } else if (hoverControl != QStyle::SC_None && (activeControl == QStyle::SC_None)) {
-        opt.activeSubControls = hoverControl;
-        opt.state |= QStyle::State_MouseOver;
-    }
-    QPainter painter(this);
-    style()->drawComplexControl(QStyle::CC_MdiControls, &opt, &painter, mdiArea);
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::mousePressEvent(QMouseEvent *event)
-{
-    if (event->button() != Qt::LeftButton) {
-        event->ignore();
-        return;
-    }
-    activeControl = getSubControl(event->pos());
-    update();
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::mouseReleaseEvent(QMouseEvent *event)
-{
-    if (event->button() != Qt::LeftButton) {
-        event->ignore();
-        return;
-    }
-
-    QStyle::SubControl under_mouse = getSubControl(event->pos());
-    if (under_mouse == activeControl) {
-        switch (activeControl) {
-        case QStyle::SC_MdiCloseButton:
-            emit _q_close();
-            break;
-        case QStyle::SC_MdiNormalButton:
-            emit _q_restore();
-            break;
-        case QStyle::SC_MdiMinButton:
-            emit _q_minimize();
-            break;
-        default:
-            break;
-        }
-    }
-
-    activeControl = QStyle::SC_None;
-    update();
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::mouseMoveEvent(QMouseEvent *event)
-{
-    QStyle::SubControl under_mouse = getSubControl(event->pos());
-    //test if hover state changes
-    if (hoverControl != under_mouse) {
-        hoverControl = under_mouse;
-        update();
-    }
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::leaveEvent(QEvent * /*event*/)
-{
-    hoverControl = QStyle::SC_None;
-    update();
-}
-
-/*
-    \internal
-*/
-bool ControllerWidget::event(QEvent *event)
-{
-#ifndef QT_NO_TOOLTIP
-    if (event->type() == QEvent::ToolTip) {
-        QStyleOptionComplex opt;
-        initStyleOption(&opt);
-        QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
-        showToolTip(helpEvent, this, opt, QStyle::CC_MdiControls, getSubControl(helpEvent->pos()));
-    }
-#endif // QT_NO_TOOLTIP
-    return QWidget::event(event);
-}
-
-/*
-    \internal
-*/
-void ControllerWidget::initStyleOption(QStyleOptionComplex *option) const
-{
-    option->initFrom(this);
-    option->subControls = visibleControls;
-    option->activeSubControls = QStyle::SC_None;
-}
-
-/*
-    \internal
-*/
-ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
-    : QObject(mdiChild),
-      previousLeft(0),
-      previousRight(0),
-#ifndef QT_NO_MENUBAR
-      m_menuBar(0),
-#endif
-      mdiChild(mdiChild)
-{
-    Q_ASSERT(mdiChild);
-
-    m_controllerWidget = new ControlElement<ControllerWidget>(mdiChild);
-    connect(m_controllerWidget, SIGNAL(_q_close()), mdiChild, SLOT(close()));
-    connect(m_controllerWidget, SIGNAL(_q_restore()), mdiChild, SLOT(showNormal()));
-    connect(m_controllerWidget, SIGNAL(_q_minimize()), mdiChild, SLOT(showMinimized()));
-
-    m_menuLabel = new ControlElement<ControlLabel>(mdiChild);
-    m_menuLabel->setWindowIcon(mdiChild->windowIcon());
-#ifndef QT_NO_MENU
-    connect(m_menuLabel, SIGNAL(_q_clicked()), mdiChild, SLOT(showSystemMenu()));
-#endif
-    connect(m_menuLabel, SIGNAL(_q_doubleClicked()), mdiChild, SLOT(close()));
-}
-
-ControlContainer::~ControlContainer()
-{
-#ifndef QT_NO_MENUBAR
-    removeButtonsFromMenuBar();
-#endif
-    delete m_menuLabel;
-    m_menuLabel = 0;
-    delete m_controllerWidget;
-    m_controllerWidget = 0;
-}
-
-#ifndef QT_NO_MENUBAR
-/*
-    \internal
-*/
-QMenuBar *QMdiSubWindowPrivate::menuBar() const
-{
-#if defined(QT_NO_MAINWINDOW)
-    return 0;
-#else
-    Q_Q(const QMdiSubWindow);
-    if (!q->isMaximized() || drawTitleBarWhenMaximized() || isChildOfTabbedQMdiArea(q))
-        return 0;
-
-    if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window()))
-        return mainWindow->menuBar();
-
-    return 0;
-#endif
-}
-
-/*
-    \internal
-*/
-void ControlContainer::showButtonsInMenuBar(QMenuBar *menuBar)
-{
-    if (!menuBar || !mdiChild || mdiChild->windowFlags() & Qt::FramelessWindowHint)
-        return;
-    m_menuBar = menuBar;
-
-    if (m_menuLabel && mdiChild->windowFlags() & Qt::WindowSystemMenuHint) {
-        QWidget *currentLeft = menuBar->cornerWidget(Qt::TopLeftCorner);
-        if (currentLeft)
-            currentLeft->hide();
-        if (currentLeft != m_menuLabel) {
-            menuBar->setCornerWidget(m_menuLabel, Qt::TopLeftCorner);
-            previousLeft = currentLeft;
-        }
-        m_menuLabel->show();
-    }
-    ControllerWidget *controllerWidget = qobject_cast<ControllerWidget *>(m_controllerWidget);
-    if (controllerWidget && controllerWidget->hasVisibleControls()) {
-        QWidget *currentRight = menuBar->cornerWidget(Qt::TopRightCorner);
-        if (currentRight)
-            currentRight->hide();
-        if (currentRight != m_controllerWidget) {
-            menuBar->setCornerWidget(m_controllerWidget, Qt::TopRightCorner);
-            previousRight = currentRight;
-        }
-        m_controllerWidget->show();
-    }
-    mdiChild->d_func()->setNewWindowTitle();
-}
-
-/*
-    \internal
-*/
-void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
-{
-    if (menuBar && menuBar != m_menuBar) {
-        // m_menubar was deleted while sub-window was maximized
-        previousRight = 0;
-        previousLeft = 0;
-        m_menuBar = menuBar;
-    }
-
-    if (!m_menuBar || !mdiChild || qt_widget_private(mdiChild->window())->data.in_destructor)
-        return;
-
-    QMdiSubWindow *child = 0;
-    if (m_controllerWidget) {
-        QWidget *currentRight = m_menuBar->cornerWidget(Qt::TopRightCorner);
-        if (currentRight == m_controllerWidget) {
-            if (ControlElement<ControllerWidget> *ce = ptr<ControllerWidget>(previousRight)) {
-                if (!ce->mdiChild || !ce->mdiChild->isMaximized())
-                    previousRight = 0;
-                else
-                    child = ce->mdiChild;
-            }
-            m_menuBar->setCornerWidget(previousRight, Qt::TopRightCorner);
-            if (previousRight) {
-                previousRight->show();
-                previousRight = 0;
-            }
-        }
-        m_controllerWidget->hide();
-        m_controllerWidget->setParent(0);
-    }
-    if (m_menuLabel) {
-        QWidget *currentLeft = m_menuBar->cornerWidget(Qt::TopLeftCorner);
-        if (currentLeft == m_menuLabel) {
-            if (ControlElement<ControlLabel> *ce = ptr<ControlLabel>(previousLeft)) {
-                if (!ce->mdiChild || !ce->mdiChild->isMaximized())
-                    previousLeft = 0;
-                else if (!child)
-                    child = mdiChild;
-            }
-            m_menuBar->setCornerWidget(previousLeft, Qt::TopLeftCorner);
-            if (previousLeft) {
-                previousLeft->show();
-                previousLeft = 0;
-            }
-        }
-        m_menuLabel->hide();
-        m_menuLabel->setParent(0);
-    }
-    m_menuBar->update();
-    if (child)
-        child->d_func()->setNewWindowTitle();
-    else if (mdiChild)
-        mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
-}
-
-#endif // QT_NO_MENUBAR
-
-void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
-{
-    if (m_menuLabel)
-        m_menuLabel->setWindowIcon(windowIcon);
-}
-
-/*!
-    \internal
-*/
-QMdiSubWindowPrivate::QMdiSubWindowPrivate()
-    : baseWidget(0),
-      restoreFocusWidget(0),
-      controlContainer(0),
-#ifndef QT_NO_SIZEGRIP
-      sizeGrip(0),
-#endif
-#ifndef QT_NO_RUBBERBAND
-      rubberBand(0),
-#endif
-      userMinimumSize(0,0),
-      resizeEnabled(true),
-      moveEnabled(true),
-      isInInteractiveMode(false),
-#ifndef QT_NO_RUBBERBAND
-      isInRubberBandMode(false),
-#endif
-      isShadeMode(false),
-      ignoreWindowTitleChange(false),
-      ignoreNextActivationEvent(false),
-      activationEnabled(true),
-      isShadeRequestFromMinimizeMode(false),
-      isMaximizeMode(false),
-      isWidgetHiddenByUs(false),
-      isActive(false),
-      isExplicitlyDeactivated(false),
-      keyboardSingleStep(5),
-      keyboardPageStep(20),
-      resizeTimerId(-1),
-      currentOperation(None),
-      hoveredSubControl(QStyle::SC_None),
-      activeSubControl(QStyle::SC_None),
-      focusInReason(Qt::ActiveWindowFocusReason)
-{
-    initOperationMap();
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::_q_updateStaysOnTopHint()
-{
-#ifndef QT_NO_ACTION
-    Q_Q(QMdiSubWindow);
-    if (QAction *senderAction = qobject_cast<QAction *>(q->sender())) {
-        if (senderAction->isChecked()) {
-            q->setWindowFlags(q->windowFlags() | Qt::WindowStaysOnTopHint);
-            q->raise();
-        } else {
-            q->setWindowFlags(q->windowFlags() & ~Qt::WindowStaysOnTopHint);
-            q->lower();
-        }
-    }
-#endif // QT_NO_ACTION
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::_q_enterInteractiveMode()
-{
-#ifndef QT_NO_ACTION
-    Q_Q(QMdiSubWindow);
-    QAction *action = qobject_cast<QAction *>(q->sender());
-    if (!action)
-        return;
-
-    QPoint pressPos;
-    if (actions[MoveAction] && actions[MoveAction] == action) {
-        currentOperation = Move;
-        pressPos = QPoint(q->width() / 2, titleBarHeight() - 1);
-    } else if (actions[ResizeAction] && actions[ResizeAction] == action) {
-        currentOperation = q->isLeftToRight() ? BottomRightResize : BottomLeftResize;
-        int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2;
-        int x = q->isLeftToRight() ? q->width() - offset : offset;
-        pressPos = QPoint(x, q->height() - offset);
-    } else {
-        return;
-    }
-
-    updateCursor();
-#ifndef QT_NO_CURSOR
-    q->cursor().setPos(q->mapToGlobal(pressPos));
-#endif
-    mousePressPosition = q->mapToParent(pressPos);
-    oldGeometry = q->geometry();
-    isInInteractiveMode = true;
-    q->setFocus();
-#ifndef QT_NO_RUBBERBAND
-    if ((q->testOption(QMdiSubWindow::RubberBandResize)
-            && (currentOperation == BottomRightResize || currentOperation == BottomLeftResize))
-            || (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) {
-        enterRubberBandMode();
-    } else
-#endif // QT_NO_RUBBERBAND
-    {
-        q->grabMouse();
-    }
-#endif // QT_NO_ACTION
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now)
-{
-    Q_UNUSED(old);
-    Q_Q(QMdiSubWindow);
-    if (now && (now == q || q->isAncestorOf(now))) {
-        if (now == q && !isInInteractiveMode)
-            setFocusWidget();
-        setActive(true);
-    }
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::leaveInteractiveMode()
-{
-    Q_Q(QMdiSubWindow);
-#ifndef QT_NO_RUBBERBAND
-    if (isInRubberBandMode)
-        leaveRubberBandMode();
-    else
-#endif
-        q->releaseMouse();
-    isInInteractiveMode = false;
-    currentOperation = None;
-    updateDirtyRegions();
-    updateCursor();
-    if (baseWidget && baseWidget->focusWidget())
-        baseWidget->focusWidget()->setFocus();
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::removeBaseWidget()
-{
-    if (!baseWidget)
-        return;
-
-    Q_Q(QMdiSubWindow);
-    baseWidget->removeEventFilter(q);
-    if (layout)
-        layout->removeWidget(baseWidget);
-    if (baseWidget->windowTitle() == q->windowTitle()) {
-        ignoreWindowTitleChange = true;
-        q->setWindowTitle(QString());
-        ignoreWindowTitleChange = false;
-        q->setWindowModified(false);
-    }
-    lastChildWindowTitle.clear();
-    baseWidget->setParent(0);
-    baseWidget = 0;
-    isWidgetHiddenByUs = false;
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::initOperationMap()
-{
-    operationMap.insert(Move, OperationInfo(HMove | VMove, Qt::ArrowCursor, false));
-    operationMap.insert(TopResize, OperationInfo(VMove | VResize | VResizeReverse, Qt::SizeVerCursor));
-    operationMap.insert(BottomResize, OperationInfo(VResize, Qt::SizeVerCursor));
-    operationMap.insert(LeftResize, OperationInfo(HMove | HResize | HResizeReverse, Qt::SizeHorCursor));
-    operationMap.insert(RightResize, OperationInfo(HResize, Qt::SizeHorCursor));
-    operationMap.insert(TopLeftResize, OperationInfo(HMove | VMove | HResize | VResize | VResizeReverse
-                                                     | HResizeReverse, Qt::SizeFDiagCursor));
-    operationMap.insert(TopRightResize, OperationInfo(VMove | HResize | VResize
-                                                      | VResizeReverse, Qt::SizeBDiagCursor));
-    operationMap.insert(BottomLeftResize, OperationInfo(HMove | HResize | VResize | HResizeReverse,
-                                                        Qt::SizeBDiagCursor));
-    operationMap.insert(BottomRightResize, OperationInfo(HResize | VResize, Qt::SizeFDiagCursor));
-}
-
-#ifndef QT_NO_MENU
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::createSystemMenu()
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT_X(q, "QMdiSubWindowPrivate::createSystemMenu",
-               "You can NOT call this function before QMdiSubWindow's ctor");
-    systemMenu = new QMenu(q);
-#ifndef QT_NO_ACTION
-    const QStyle *style = q->style();
-    addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal()));
-    actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q));
-    actions[RestoreAction]->setEnabled(false);
-    addToSystemMenu(MoveAction, QMdiSubWindow::tr("&Move"), SLOT(_q_enterInteractiveMode()));
-    addToSystemMenu(ResizeAction, QMdiSubWindow::tr("&Size"), SLOT(_q_enterInteractiveMode()));
-    addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), SLOT(showMinimized()));
-    actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, 0, q));
-    addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), SLOT(showMaximized()));
-    actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, 0, q));
-    addToSystemMenu(StayOnTopAction, QMdiSubWindow::tr("Stay on &Top"), SLOT(_q_updateStaysOnTopHint()));
-    actions[StayOnTopAction]->setCheckable(true);
-    systemMenu->addSeparator();
-    addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close()));
-    actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q));
-#if !defined(QT_NO_SHORTCUT)
-    actions[CloseAction]->setShortcuts(QKeySequence::Close);
-#endif
-#endif // QT_NO_ACTION
-    updateActions();
-}
-#endif
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::updateCursor()
-{
-#ifndef QT_NO_CURSOR
-    Q_Q(QMdiSubWindow);
-
-    if (currentOperation == None) {
-        q->unsetCursor();
-        return;
-    }
-
-    if (currentOperation == Move || operationMap.find(currentOperation).value().hover) {
-        q->setCursor(operationMap.find(currentOperation).value().cursorShape);
-        return;
-    }
-#endif
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::updateDirtyRegions()
-{
-    // No update necessary
-    if (!parent)
-        return;
-
-    foreach (Operation operation, operationMap.keys())
-        operationMap.find(operation).value().region = getRegion(operation);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::updateGeometryConstraints()
-{
-    Q_Q(QMdiSubWindow);
-    if (!parent)
-        return;
-
-    internalMinimumSize = (!q->isMinimized() && !q->minimumSize().isNull())
-                          ? q->minimumSize() : q->minimumSizeHint();
-    int margin, minWidth;
-    sizeParameters(&margin, &minWidth);
-    q->setContentsMargins(margin, titleBarHeight(), margin, margin);
-    if (q->isMaximized() || (q->isMinimized() && !q->isShaded())) {
-        moveEnabled = false;
-        resizeEnabled = false;
-    } else {
-        moveEnabled = true;
-        resizeEnabled = !q->isShaded();
-    }
-    updateDirtyRegions();
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::updateMask()
-{
-    Q_Q(QMdiSubWindow);
-    if (!q->mask().isEmpty())
-        q->clearMask();
-
-    if (!parent)
-        return;
-
-    if ((q->isMaximized() && !drawTitleBarWhenMaximized())
-        || q->windowFlags() & Qt::FramelessWindowHint)
-        return;
-
-    if (resizeTimerId == -1)
-        cachedStyleOptions = titleBarOptions();
-    cachedStyleOptions.rect = q->rect();
-    QStyleHintReturnMask frameMask;
-    q->style()->styleHint(QStyle::SH_WindowFrame_Mask, &cachedStyleOptions, q, &frameMask);
-    if (!frameMask.region.isEmpty())
-        q->setMask(frameMask.region);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos)
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(currentOperation != None);
-    Q_ASSERT(parent);
-
-    uint cflags = operationMap.find(currentOperation).value().changeFlags;
-    int posX = pos.x();
-    int posY = pos.y();
-
-    const bool restrictHorizontal = !q->testOption(QMdiSubWindow::AllowOutsideAreaHorizontally);
-    const bool restrictVertical = !q->testOption(QMdiSubWindow::AllowOutsideAreaVertically);
-
-    if (restrictHorizontal || restrictVertical) {
-        QRect parentRect = q->parentWidget()->rect();
-        if (restrictVertical && (cflags & VResizeReverse || currentOperation == Move)) {
-            posY = qMin(qMax(mousePressPosition.y() - oldGeometry.y(), posY),
-                        parentRect.height() - BoundaryMargin);
-        }
-        if (currentOperation == Move) {
-            if (restrictHorizontal)
-                posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin);
-            if (restrictVertical)
-                posY = qMin(posY, parentRect.height() - BoundaryMargin);
-        } else {
-            if (restrictHorizontal) {
-                if (cflags & HResizeReverse)
-                    posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX);
-                else
-                    posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width()
-                                                      - mousePressPosition.x()), posX);
-            }
-            if (restrictVertical && !(cflags & VResizeReverse)) {
-                posY = qMin(parentRect.height() - (oldGeometry.y() + oldGeometry.height()
-                                                   - mousePressPosition.y()), posY);
-            }
-        }
-    }
-
-    QRect geometry;
-    if (cflags & (HMove | VMove)) {
-        int dx = getMoveDeltaComponent(cflags, HMove, HResize, posX - mousePressPosition.x(),
-                                       oldGeometry.width() - internalMinimumSize.width(),
-                                       oldGeometry.width() - q->maximumWidth());
-        int dy = getMoveDeltaComponent(cflags, VMove, VResize, posY - mousePressPosition.y(),
-                                       oldGeometry.height() - internalMinimumSize.height(),
-                                       oldGeometry.height() - q->maximumHeight());
-        geometry.setTopLeft(oldGeometry.topLeft() + QPoint(dx, dy));
-    } else {
-        geometry.setTopLeft(q->geometry().topLeft());
-    }
-
-    if (cflags & (HResize | VResize)) {
-        int dx = getResizeDeltaComponent(cflags, HResize, HResizeReverse,
-                                         posX - mousePressPosition.x());
-        int dy = getResizeDeltaComponent(cflags, VResize, VResizeReverse,
-                                         posY - mousePressPosition.y());
-        geometry.setSize(oldGeometry.size() + QSize(dx, dy));
-    } else {
-        geometry.setSize(q->geometry().size());
-    }
-
-    setNewGeometry(&geometry);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setMinimizeMode()
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(parent);
-
-    ensureWindowState(Qt::WindowMinimized);
-    isShadeRequestFromMinimizeMode = true;
-    q->showShaded();
-    isShadeRequestFromMinimizeMode = false;
-
-    moveEnabled = false;
-#ifndef QT_NO_ACTION
-    setEnabled(MoveAction, moveEnabled);
-#endif
-
-    Q_ASSERT(q->windowState() & Qt::WindowMinimized);
-    Q_ASSERT(!(q->windowState() & Qt::WindowMaximized));
-    // This should be a valid assert, but people can actually re-implement
-    // setVisible and do crazy stuff, so we're not guaranteed that
-    // the widget is hidden after calling hide().
-    // Q_ASSERT(baseWidget ? baseWidget->isHidden() : true);
-
-    setActive(true);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setNormalMode()
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(parent);
-
-    isShadeMode = false;
-    isMaximizeMode = false;
-
-    ensureWindowState(Qt::WindowNoState);
-#ifndef QT_NO_MENUBAR
-    removeButtonsFromMenuBar();
-#endif
-
-    // Hide the window before we change the geometry to avoid multiple resize
-    // events and wrong window state.
-    const bool wasVisible = q->isVisible();
-    if (wasVisible)
-        q->setVisible(false);
-
-    // Restore minimum size if set by user.
-    if (!userMinimumSize.isNull()) {
-        q->setMinimumSize(userMinimumSize);
-        userMinimumSize = QSize(0, 0);
-    }
-
-    // Show the internal widget if it was hidden by us,
-    if (baseWidget && isWidgetHiddenByUs) {
-        baseWidget->show();
-        isWidgetHiddenByUs = false;
-    }
-
-    updateGeometryConstraints();
-    QRect newGeometry = oldGeometry;
-    newGeometry.setSize(restoreSize.expandedTo(internalMinimumSize));
-    q->setGeometry(newGeometry);
-
-    if (wasVisible)
-        q->setVisible(true);
-
-    // Invalidate the restore size.
-    restoreSize.setWidth(-1);
-    restoreSize.setHeight(-1);
-
-#ifndef QT_NO_SIZEGRIP
-    setSizeGripVisible(true);
-#endif
-
-#ifndef QT_NO_ACTION
-    setEnabled(MoveAction, true);
-    setEnabled(MaximizeAction, true);
-    setEnabled(MinimizeAction, true);
-    setEnabled(RestoreAction, false);
-    setEnabled(ResizeAction, resizeEnabled);
-#endif // QT_NO_ACTION
-
-    Q_ASSERT(!(q_func()->windowState() & Qt::WindowMinimized));
-    // This sub-window can be maximized when shown above if not the
-    // QMdiArea::DontMaximizeSubWindowOnActionvation is set. Make sure
-    // the Qt::WindowMaximized flag is set accordingly.
-    Q_ASSERT((isMaximizeMode && q_func()->windowState() & Qt::WindowMaximized)
-             || (!isMaximizeMode && !(q_func()->windowState() & Qt::WindowMaximized)));
-    Q_ASSERT(!isShadeMode);
-
-    setActive(true);
-    restoreFocus();
-    updateMask();
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setMaximizeMode()
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(parent);
-
-    ensureWindowState(Qt::WindowMaximized);
-    isShadeMode = false;
-    isMaximizeMode = true;
-
-    if (!restoreFocusWidget && q->isAncestorOf(QApplication::focusWidget()))
-        restoreFocusWidget = QApplication::focusWidget();
-
-#ifndef QT_NO_SIZEGRIP
-    setSizeGripVisible(false);
-#endif
-
-    // Store old geometry and set restore size if not already set.
-    if (!restoreSize.isValid()) {
-        oldGeometry = q->geometry();
-        restoreSize.setWidth(oldGeometry.width());
-        restoreSize.setHeight(oldGeometry.height());
-    }
-
-    // Hide the window before we change the geometry to avoid multiple resize
-    // events and wrong window state.
-    const bool wasVisible = q->isVisible();
-    if (wasVisible)
-        q->setVisible(false);
-
-    // Show the internal widget if it was hidden by us.
-    if (baseWidget && isWidgetHiddenByUs) {
-        baseWidget->show();
-        isWidgetHiddenByUs = false;
-    }
-
-    updateGeometryConstraints();
-
-    if (wasVisible) {
-#ifndef QT_NO_MENUBAR
-        if (QMenuBar *mBar = menuBar())
-            showButtonsInMenuBar(mBar);
-        else
-#endif
-        if (!controlContainer)
-            controlContainer = new ControlContainer(q);
-    }
-
-    QWidget *parent = q->parentWidget();
-    QRect availableRect = parent->contentsRect();
-
-    // Adjust geometry if the sub-window is inside a scroll area.
-    QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget());
-    if (scrollArea && scrollArea->viewport() == parent) {
-        QScrollBar *hbar = scrollArea->horizontalScrollBar();
-        QScrollBar *vbar = scrollArea->verticalScrollBar();
-        const int xOffset = hbar ? hbar->value() : 0;
-        const int yOffset = vbar ? vbar->value() : 0;
-        availableRect.adjust(-xOffset, -yOffset, -xOffset, -yOffset);
-        oldGeometry.adjust(xOffset, yOffset, xOffset, yOffset);
-    }
-
-    setNewGeometry(&availableRect);
-    // QWidget::setGeometry will reset Qt::WindowMaximized so we have to update it here.
-    ensureWindowState(Qt::WindowMaximized);
-
-    if (wasVisible)
-        q->setVisible(true);
-
-    resizeEnabled = false;
-    moveEnabled = false;
-
-#ifndef QT_NO_ACTION
-    setEnabled(MoveAction, moveEnabled);
-    setEnabled(MaximizeAction, false);
-    setEnabled(MinimizeAction, true);
-    setEnabled(RestoreAction, true);
-    setEnabled(ResizeAction, resizeEnabled);
-#endif // QT_NO_ACTION
-
-    Q_ASSERT(q->windowState() & Qt::WindowMaximized);
-    Q_ASSERT(!(q->windowState() & Qt::WindowMinimized));
-
-    restoreFocus();
-    updateMask();
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
-{
-    Q_Q(QMdiSubWindow);
-    if (!parent || !activationEnabled)
-        return;
-
-    if (activate && !isActive && q->isEnabled()) {
-        isActive = true;
-        isExplicitlyDeactivated = false;
-        Qt::WindowStates oldWindowState = q->windowState();
-        ensureWindowState(Qt::WindowActive);
-        emit q->aboutToActivate();
-#ifndef QT_NO_MENUBAR
-        if (QMenuBar *mBar = menuBar())
-            showButtonsInMenuBar(mBar);
-#endif
-        Q_ASSERT(isActive);
-        emit q->windowStateChanged(oldWindowState, q->windowState());
-    } else if (!activate && isActive) {
-        isActive = false;
-        Qt::WindowStates oldWindowState = q->windowState();
-        q->overrideWindowState(q->windowState() & ~Qt::WindowActive);
-        if (changeFocus) {
-            QWidget *focusWidget = QApplication::focusWidget();
-            if (focusWidget && (focusWidget == q || q->isAncestorOf(focusWidget)))
-                focusWidget->clearFocus();
-        }
-        if (baseWidget)
-            baseWidget->overrideWindowState(baseWidget->windowState() & ~Qt::WindowActive);
-        Q_ASSERT(!isActive);
-        emit q->windowStateChanged(oldWindowState, q->windowState());
-    }
-
-    if (activate && isActive && q->isEnabled() && !q->hasFocus()
-            && !q->isAncestorOf(QApplication::focusWidget())) {
-        if (changeFocus)
-            setFocusWidget();
-        ensureWindowState(Qt::WindowActive);
-    }
-
-    int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
-    int titleBarHeight = this->titleBarHeight();
-    QRegion windowDecoration = QRegion(0, 0, q->width(), q->height());
-    windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth,
-                                q->height() - titleBarHeight - frameWidth);
-
-    // Make sure we don't use cached style options if we get
-    // resize events right before activation/deactivation.
-    if (resizeTimerId != -1) {
-        q->killTimer(resizeTimerId);
-        resizeTimerId = -1;
-        updateDirtyRegions();
-    }
-
-    q->update(windowDecoration);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::processClickedSubControl()
-{
-    Q_Q(QMdiSubWindow);
-    switch (activeSubControl) {
-    case QStyle::SC_TitleBarContextHelpButton:
-#ifndef QT_NO_WHATSTHIS
-        QWhatsThis::enterWhatsThisMode();
-#endif
-        break;
-    case QStyle::SC_TitleBarShadeButton:
-        q->showShaded();
-        hoveredSubControl = QStyle::SC_TitleBarUnshadeButton;
-        break;
-    case QStyle::SC_TitleBarUnshadeButton:
-        if (q->isShaded())
-            hoveredSubControl = QStyle::SC_TitleBarShadeButton;
-        q->showNormal();
-        break;
-    case QStyle::SC_TitleBarMinButton:
-        q->showMinimized();
-        break;
-    case QStyle::SC_TitleBarNormalButton:
-        if (q->isShaded())
-            hoveredSubControl = QStyle::SC_TitleBarMinButton;
-        q->showNormal();
-        break;
-    case QStyle::SC_TitleBarMaxButton:
-        q->showMaximized();
-        break;
-    case QStyle::SC_TitleBarCloseButton:
-        q->close();
-        break;
-    default:
-        break;
-    }
-}
-
-/*!
-    \internal
-*/
-QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
-{
-    Q_Q(const QMdiSubWindow);
-    int width = q->width();
-    int height = q->height();
-    int titleBarHeight = this->titleBarHeight();
-    int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
-    int cornerConst = titleBarHeight - frameWidth;
-    int titleBarConst = 2 * titleBarHeight;
-
-    if (operation == Move) {
-        QStyleOptionTitleBar titleBarOptions = this->titleBarOptions();
-        QRegion move(frameWidth, frameWidth, width - 2 * frameWidth, cornerConst);
-        // Depending on which window flags are set, activated sub controllers will
-        // be subtracted from the 'move' region.
-        for (int i = 0; i < NumSubControls; ++i) {
-            if (SubControls[i] == QStyle::SC_TitleBarLabel)
-                continue;
-            move -= QRegion(q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions,
-                            SubControls[i]));
-        }
-        return move;
-    }
-
-    QRegion region;
-    switch (operation) {
-    case TopResize:
-        region = QRegion(titleBarHeight, 0, width - titleBarConst, frameWidth);
-        break;
-    case BottomResize:
-        region = QRegion(titleBarHeight, height - frameWidth, width - titleBarConst, frameWidth);
-        break;
-    case LeftResize:
-        region = QRegion(0, titleBarHeight, frameWidth, height - titleBarConst);
-        break;
-    case RightResize:
-        region = QRegion(width - frameWidth, titleBarHeight, frameWidth, height - titleBarConst);
-        break;
-    case TopLeftResize:
-        region = QRegion(0, 0, titleBarHeight, titleBarHeight)
-                 - QRegion(frameWidth, frameWidth, cornerConst, cornerConst);
-        break;
-    case TopRightResize:
-        region =  QRegion(width - titleBarHeight, 0, titleBarHeight, titleBarHeight)
-                  - QRegion(width - titleBarHeight, frameWidth, cornerConst, cornerConst);
-        break;
-    case BottomLeftResize:
-        region = QRegion(0, height - titleBarHeight, titleBarHeight, titleBarHeight)
-                 - QRegion(frameWidth, height - titleBarHeight, cornerConst, cornerConst);
-        break;
-    case BottomRightResize:
-        region = QRegion(width - titleBarHeight, height - titleBarHeight, titleBarHeight, titleBarHeight)
-                 - QRegion(width - titleBarHeight, height - titleBarHeight, cornerConst, cornerConst);
-        break;
-    default:
-        break;
-    }
-
-    return region;
-}
-
-/*!
-    \internal
-*/
-QMdiSubWindowPrivate::Operation QMdiSubWindowPrivate::getOperation(const QPoint &pos) const
-{
-    OperationInfoMap::const_iterator it;
-    for (it = operationMap.constBegin(); it != operationMap.constEnd(); ++it)
-        if (it.value().region.contains(pos))
-            return it.key();
-    return None;
-}
-
-extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*);
-
-/*!
-    \internal
-*/
-QStyleOptionTitleBar QMdiSubWindowPrivate::titleBarOptions() const
-{
-    Q_Q(const QMdiSubWindow);
-    QStyleOptionTitleBar titleBarOptions;
-    titleBarOptions.initFrom(q);
-    if (activeSubControl != QStyle::SC_None) {
-        if (hoveredSubControl == activeSubControl) {
-            titleBarOptions.state |= QStyle::State_Sunken;
-            titleBarOptions.activeSubControls = activeSubControl;
-        }
-    } else if (autoRaise() && hoveredSubControl != QStyle::SC_None
-               && hoveredSubControl != QStyle::SC_TitleBarLabel) {
-        titleBarOptions.state |= QStyle::State_MouseOver;
-        titleBarOptions.activeSubControls = hoveredSubControl;
-    } else {
-        titleBarOptions.state &= ~QStyle::State_MouseOver;
-        titleBarOptions.activeSubControls = QStyle::SC_None;
-    }
-
-    titleBarOptions.subControls = QStyle::SC_All;
-    titleBarOptions.titleBarFlags = q->windowFlags();
-    titleBarOptions.titleBarState = q->windowState();
-    titleBarOptions.palette = titleBarPalette;
-    titleBarOptions.icon = menuIcon;
-
-    if (isActive) {
-        titleBarOptions.state |= QStyle::State_Active;
-        titleBarOptions.titleBarState |= QStyle::State_Active;
-        titleBarOptions.palette.setCurrentColorGroup(QPalette::Active);
-    } else {
-        titleBarOptions.state &= ~QStyle::State_Active;
-        titleBarOptions.palette.setCurrentColorGroup(QPalette::Inactive);
-    }
-
-    int border = hasBorder(titleBarOptions) ? 4 : 0;
-    int paintHeight = titleBarHeight(titleBarOptions);
-    paintHeight -= q->isMinimized() ? 2 * border : border;
-    titleBarOptions.rect = QRect(border, border, q->width() - 2 * border, paintHeight);
-
-    if (!windowTitle.isEmpty()) {
-        // Set the text here before asking for the width of the title bar label
-        // in case people uses the actual text to calculate the width.
-        titleBarOptions.text = windowTitle;
-        titleBarOptions.fontMetrics = QFontMetrics(font);
-        int width = q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions,
-                                               QStyle::SC_TitleBarLabel, q).width();
-        // Set elided text if we don't have enough space for the entire title.
-        titleBarOptions.text = titleBarOptions.fontMetrics.elidedText(windowTitle, Qt::ElideRight, width);
-    }
-    return titleBarOptions;
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state)
-{
-    Q_Q(QMdiSubWindow);
-    Qt::WindowStates windowStates = q->windowState() | state;
-    switch (state) {
-    case Qt::WindowMinimized:
-        windowStates &= ~Qt::WindowMaximized;
-        windowStates &= ~Qt::WindowNoState;
-        break;
-    case Qt::WindowMaximized:
-        windowStates &= ~Qt::WindowMinimized;
-        windowStates &= ~Qt::WindowNoState;
-        break;
-    case Qt::WindowNoState:
-        windowStates &= ~Qt::WindowMinimized;
-        windowStates &= ~Qt::WindowMaximized;
-        break;
-    default:
-        break;
-    }
-    if (baseWidget) {
-        if (!(baseWidget->windowState() & Qt::WindowActive) && windowStates & Qt::WindowActive)
-            baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive);
-        else
-            baseWidget->overrideWindowState(windowStates);
-    }
-    q->overrideWindowState(windowStates);
-}
-
-/*!
-    \internal
-*/
-int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const
-{
-    Q_Q(const QMdiSubWindow);
-    if (!parent || q->windowFlags() & Qt::FramelessWindowHint
-        || (q->isMaximized() && !drawTitleBarWhenMaximized())) {
-        return 0;
-    }
-
-    int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
-    if (hasBorder(options))
-        height += q->isMinimized() ? 8 : 4;
-    return height;
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const
-{
-    Q_Q(const QMdiSubWindow);
-    Qt::WindowFlags flags = q->windowFlags();
-    if (!parent || flags & Qt::FramelessWindowHint) {
-        *margin = 0;
-        *minWidth = 0;
-        return;
-    }
-
-    if (q->isMaximized() && !drawTitleBarWhenMaximized())
-        *margin = 0;
-    else
-        *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);
-
-    QStyleOptionTitleBar opt = this->titleBarOptions();
-    int tempWidth = 0;
-    for (int i = 0; i < NumSubControls; ++i) {
-        if (SubControls[i] == QStyle::SC_TitleBarLabel) {
-            tempWidth += 30;
-            continue;
-        }
-        QRect rect = q->style()->subControlRect(QStyle::CC_TitleBar, &opt, SubControls[i], q);
-        if (!rect.isValid())
-            continue;
-        tempWidth += rect.width();
-    }
-    *minWidth = tempWidth;
-}
-
-/*!
-    \internal
-*/
-bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
-{
-    Q_Q(const QMdiSubWindow);
-    if (isChildOfTabbedQMdiArea(q))
-        return false;
-
-    if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
-        return true;
-#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW)
-    return true;
-#else
-    QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window());
-    if (!mainWindow || !qobject_cast<QMenuBar *>(mainWindow->menuWidget())
-        || mainWindow->menuWidget()->isHidden())
-        return true;
-
-    return isChildOfQMdiSubWindow(q);
-#endif
-}
-
-#ifndef QT_NO_MENUBAR
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::showButtonsInMenuBar(QMenuBar *menuBar)
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(q->isMaximized() && !drawTitleBarWhenMaximized());
-
-    if (isChildOfTabbedQMdiArea(q))
-        return;
-
-    removeButtonsFromMenuBar();
-    if (!controlContainer)
-        controlContainer = new ControlContainer(q);
-
-    ignoreWindowTitleChange = true;
-    controlContainer->showButtonsInMenuBar(menuBar);
-    ignoreWindowTitleChange = false;
-
-    QWidget *topLevelWindow = q->window();
-    topLevelWindow->setWindowModified(q->isWindowModified());
-    topLevelWindow->installEventFilter(q);
-
-    int buttonHeight = 0;
-    if (controlContainer->controllerWidget())
-        buttonHeight = controlContainer->controllerWidget()->height();
-    else if (controlContainer->systemMenuLabel())
-        buttonHeight = controlContainer->systemMenuLabel()->height();
-
-    // This will rarely happen.
-    if (menuBar && menuBar->height() < buttonHeight
-            && topLevelWindow->layout()) {
-        // Make sure topLevelWindow->contentsRect returns correct geometry.
-        // topLevelWidget->updateGeoemtry will not do the trick here since it will post the event.
-        QEvent event(QEvent::LayoutRequest);
-        QApplication::sendEvent(topLevelWindow, &event);
-    }
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
-{
-    Q_Q(QMdiSubWindow);
-
-    if (!controlContainer || isChildOfTabbedQMdiArea(q))
-        return;
-
-    QMenuBar *currentMenuBar = 0;
-#ifndef QT_NO_MAINWINDOW
-    if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) {
-        // NB! We can't use menuBar() here because that one will actually create
-        // a menubar for us if not set. That's not what we want :-)
-        currentMenuBar = qobject_cast<QMenuBar *>(mainWindow->menuWidget());
-    }
-#endif
-
-    ignoreWindowTitleChange = true;
-    controlContainer->removeButtonsFromMenuBar(currentMenuBar);
-    ignoreWindowTitleChange = false;
-
-    QWidget *topLevelWindow = q->window();
-    topLevelWindow->removeEventFilter(q);
-    if (baseWidget && !drawTitleBarWhenMaximized())
-        topLevelWindow->setWindowModified(false);
-    originalTitle = QString();
-}
-
-#endif // QT_NO_MENUBAR
-
-void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
-{
-    Q_Q(QMdiSubWindow);
-    if (isRequestFromChild && !q->windowTitle().isEmpty() && !lastChildWindowTitle.isEmpty()
-            && lastChildWindowTitle != q->windowTitle()) {
-        return;
-    }
-
-    QWidget *titleWidget = 0;
-    if (isRequestFromChild)
-        titleWidget = baseWidget;
-    else
-        titleWidget = q;
-    if (!titleWidget || titleWidget->windowTitle().isEmpty())
-        return;
-
-    ignoreWindowTitleChange = true;
-    q->setWindowTitle(titleWidget->windowTitle());
-    if (q->maximizedButtonsWidget())
-        setNewWindowTitle();
-    ignoreWindowTitleChange = false;
-}
-
-#ifndef QT_NO_RUBBERBAND
-void QMdiSubWindowPrivate::enterRubberBandMode()
-{
-    Q_Q(QMdiSubWindow);
-    if (q->isMaximized())
-        return;
-    Q_ASSERT(oldGeometry.isValid());
-    Q_ASSERT(parent);
-    if (!rubberBand) {
-        rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget());
-        // For accessibility to identify this special widget.
-        rubberBand->setObjectName(QLatin1String("qt_rubberband"));
-    }
-    QPoint rubberBandPos = q->mapToParent(QPoint(0, 0));
-    rubberBand->setGeometry(rubberBandPos.x(), rubberBandPos.y(),
-                            oldGeometry.width(), oldGeometry.height());
-    rubberBand->show();
-    isInRubberBandMode = true;
-    q->grabMouse();
-}
-
-void QMdiSubWindowPrivate::leaveRubberBandMode()
-{
-    Q_Q(QMdiSubWindow);
-    Q_ASSERT(rubberBand);
-    Q_ASSERT(isInRubberBandMode);
-    q->releaseMouse();
-    isInRubberBandMode = false;
-    q->setGeometry(rubberBand->geometry());
-    rubberBand->hide();
-    currentOperation = None;
-}
-#endif // QT_NO_RUBBERBAND
-
-// Taken from the old QWorkspace (::readColors())
-QPalette QMdiSubWindowPrivate::desktopPalette() const
-{
-    Q_Q(const QMdiSubWindow);
-    QPalette newPalette = q->palette();
-
-    newPalette.setColor(QPalette::Active, QPalette::Highlight,
-                        newPalette.color(QPalette::Active, QPalette::Highlight));
-    newPalette.setColor(QPalette::Active, QPalette::Base,
-                        newPalette.color(QPalette::Active, QPalette::Highlight));
-    newPalette.setColor(QPalette::Inactive, QPalette::Highlight,
-                        newPalette.color(QPalette::Inactive, QPalette::Dark));
-    newPalette.setColor(QPalette::Inactive, QPalette::Base,
-                        newPalette.color(QPalette::Inactive, QPalette::Dark));
-    newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText,
-                        newPalette.color(QPalette::Inactive, QPalette::Window));
-
-    return newPalette;
-}
-
-void QMdiSubWindowPrivate::updateActions()
-{
-    Qt::WindowFlags windowFlags = q_func()->windowFlags();
-    // Hide all
-    for (int i = 0; i < NumWindowStateActions; ++i)
-        setVisible(WindowStateAction(i), false);
-
-    if (windowFlags & Qt::FramelessWindowHint)
-        return;
-
-    setVisible(StayOnTopAction, true);
-    setVisible(MoveAction, moveEnabled);
-    setVisible(ResizeAction, resizeEnabled);
-
-    // CloseAction
-    if (windowFlags & Qt::WindowSystemMenuHint)
-        setVisible(CloseAction, true);
-
-    // RestoreAction
-    if (windowFlags & (Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint))
-        setVisible(RestoreAction, true);
-
-    // MinimizeAction
-    if (windowFlags & Qt::WindowMinimizeButtonHint)
-        setVisible(MinimizeAction, true);
-
-    // MaximizeAction
-    if (windowFlags & Qt::WindowMaximizeButtonHint)
-        setVisible(MaximizeAction, true);
-}
-
-void QMdiSubWindowPrivate::setFocusWidget()
-{
-    Q_Q(QMdiSubWindow);
-    if (!baseWidget) {
-        q->setFocus();
-        return;
-    }
-
-    // This will give focus to the next child if possible, otherwise
-    // do nothing, hence it's not possible to tab between windows with
-    // just hitting tab (unless Qt::TabFocus is removed from the focus policy).
-    if (focusInReason == Qt::TabFocusReason) {
-        q->focusNextChild();
-        return;
-    }
-
-    // Same as above, but gives focus to the previous child.
-    if (focusInReason == Qt::BacktabFocusReason) {
-        q->focusPreviousChild();
-        return;
-    }
-
-    if (QWidget *focusWidget = baseWidget->focusWidget()) {
-        if (!focusWidget->hasFocus() && q->isAncestorOf(focusWidget)
-                && focusWidget->isVisible() && !q->isMinimized()
-                && focusWidget->focusPolicy() != Qt::NoFocus) {
-            focusWidget->setFocus();
-        } else {
-            q->setFocus();
-        }
-        return;
-    }
-
-    QWidget *focusWidget = q->nextInFocusChain();
-    while (focusWidget && focusWidget != q && focusWidget->focusPolicy() == Qt::NoFocus)
-        focusWidget = focusWidget->nextInFocusChain();
-    if (focusWidget && q->isAncestorOf(focusWidget))
-        focusWidget->setFocus();
-    else if (baseWidget->focusPolicy() != Qt::NoFocus)
-        baseWidget->setFocus();
-    else if (!q->hasFocus())
-        q->setFocus();
-}
-
-void QMdiSubWindowPrivate::restoreFocus()
-{
-    if (!restoreFocusWidget)
-        return;
-    if (!restoreFocusWidget->hasFocus() && q_func()->isAncestorOf(restoreFocusWidget)
-            && restoreFocusWidget->isVisible()
-            && restoreFocusWidget->focusPolicy() != Qt::NoFocus) {
-        restoreFocusWidget->setFocus();
-    }
-    restoreFocusWidget = 0;
-}
-
-/*!
-    \internal
-    ### Please add QEvent::WindowFlagsChange event
-*/
-void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags)
-{
-    Q_Q(QMdiSubWindow);
-    if (!parent) {
-        q->setWindowFlags(windowFlags);
-        return;
-    }
-
-    Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask;
-    if (windowType == Qt::Dialog)
-        windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint;
-
-    // Set standard flags if none of the customize flags are set
-    if (!(windowFlags & CustomizeWindowFlags))
-        windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
-    else if (windowFlags & Qt::FramelessWindowHint && windowFlags & Qt::WindowStaysOnTopHint)
-        windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
-    else if (windowFlags & Qt::FramelessWindowHint)
-        windowFlags = Qt::FramelessWindowHint;
-
-    windowFlags &= ~windowType;
-    windowFlags |= Qt::SubWindow;
-
-#ifndef QT_NO_ACTION
-    if (QAction *stayOnTopAction = actions[QMdiSubWindowPrivate::StayOnTopAction]) {
-        if (windowFlags & Qt::WindowStaysOnTopHint)
-            stayOnTopAction->setChecked(true);
-        else
-            stayOnTopAction->setChecked(false);
-    }
-#endif
-
-#ifndef QT_NO_SIZEGRIP
-    if ((windowFlags & Qt::FramelessWindowHint) && sizeGrip)
-        delete sizeGrip;
-#endif
-
-    q->setWindowFlags(windowFlags);
-    updateGeometryConstraints();
-    updateActions();
-    QSize currentSize = q->size();
-    if (q->isVisible() && (currentSize.width() < internalMinimumSize.width()
-            || currentSize.height() < internalMinimumSize.height())) {
-        q->resize(currentSize.expandedTo(internalMinimumSize));
-    }
-}
-
-void QMdiSubWindowPrivate::setVisible(WindowStateAction action, bool visible)
-{
-#ifndef QT_NO_ACTION
-    if (actions[action])
-        actions[action]->setVisible(visible);
-#endif
-
-    Q_Q(QMdiSubWindow);
-    if (!controlContainer)
-        controlContainer = new ControlContainer(q);
-
-    if (ControllerWidget *ctrlWidget = qobject_cast<ControllerWidget *>
-                                       (controlContainer->controllerWidget())) {
-        ctrlWidget->setControlVisible(action, visible);
-    }
-}
-
-#ifndef QT_NO_ACTION
-void QMdiSubWindowPrivate::setEnabled(WindowStateAction action, bool enable)
-{
-    if (actions[action])
-        actions[action]->setEnabled(enable);
-}
-
-#ifndef QT_NO_MENU
-void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QString &text,
-                                           const char *slot)
-{
-    if (!systemMenu)
-        return;
-    actions[action] = systemMenu->addAction(text, q_func(), slot);
-}
-#endif // QT_NO_MENU
-#endif // QT_NO_ACTION
-
-/*!
-    \internal
-*/
-QSize QMdiSubWindowPrivate::iconSize() const
-{
-    Q_Q(const QMdiSubWindow);
-    if (!parent || q->windowFlags() & Qt::FramelessWindowHint)
-        return QSize(-1, -1);
-    return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
-}
-
-#ifndef QT_NO_SIZEGRIP
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
-{
-    Q_Q(QMdiSubWindow);
-    if (!newSizeGrip || sizeGrip || q->windowFlags() & Qt::FramelessWindowHint)
-        return;
-
-    if (layout && layout->indexOf(newSizeGrip) != -1)
-        return;
-    newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
-    if (layout) {
-        layout->addWidget(newSizeGrip);
-        layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
-    } else {
-        newSizeGrip->setParent(q);
-        newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0,
-                          q->height() - newSizeGrip->height());
-        sizeGrip = newSizeGrip;
-    }
-    newSizeGrip->raise();
-    updateGeometryConstraints();
-    newSizeGrip->installEventFilter(q);
-}
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::setSizeGripVisible(bool visible) const
-{
-    // See if we can find any size grips
-    QList<QSizeGrip *> sizeGrips = q_func()->findChildren<QSizeGrip *>();
-    foreach (QSizeGrip *grip, sizeGrips)
-        grip->setVisible(visible);
-}
-
-#endif // QT_NO_SIZEGRIP
-
-/*!
-    \internal
-*/
-void QMdiSubWindowPrivate::updateInternalWindowTitle()
-{
-    Q_Q(QMdiSubWindow);
-    if (q->isWindowModified()) {
-        windowTitle = q->windowTitle();
-        windowTitle.replace(QLatin1String("[*]"), QLatin1String("*"));
-    } else {
-        windowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q);
-    }
-    q->update(0, 0, q->width(), titleBarHeight());
-}
-
-/*!
-    Constructs a new QMdiSubWindow widget. The \a parent and \a
-    flags arguments are passed to QWidget's constructor.
-
-    Instead of using addSubWindow(), it is also simply possible to
-    use setParent() when you add the subwindow to a QMdiArea.
-
-    Note that only \l{QMdiSubWindow}s can be set as children of
-    QMdiArea; you cannot, for instance, write:
-
-    \badcode
-        QMdiArea mdiArea;
-        QTextEdit editor(&mdiArea); // invalid child widget
-    \endcode
-
-    \sa QMdiArea::addSubWindow()
-*/
-QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
-    : QWidget(*new QMdiSubWindowPrivate, parent, 0)
-{
-    Q_D(QMdiSubWindow);
-#ifndef QT_NO_MENU
-    d->createSystemMenu();
-    addActions(d->systemMenu->actions());
-#endif
-    d->setWindowFlags(flags);
-    setBackgroundRole(QPalette::Window);
-    setAutoFillBackground(true);
-    setMouseTracking(true);
-    setLayout(new QVBoxLayout);
-    setFocusPolicy(Qt::StrongFocus);
-    layout()->setMargin(0);
-    d->updateGeometryConstraints();
-    setAttribute(Qt::WA_Resized, false);
-    d->titleBarPalette = d->desktopPalette();
-    d->font = QApplication::font("QWorkspaceTitleBar");
-    const QIcon wicon = windowIcon();
-    if (wicon.isNull())
-        d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
-    else
-        d->menuIcon = wicon;
-    connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),
-            this, SLOT(_q_processFocusChanged(QWidget*,QWidget*)));
-}
-
-/*!
-    Destroys the subwindow.
-
-    \sa QMdiArea::removeSubWindow()
-*/
-QMdiSubWindow::~QMdiSubWindow()
-{
-    Q_D(QMdiSubWindow);
-#ifndef QT_NO_MENUBAR
-    d->removeButtonsFromMenuBar();
-#endif
-    d->setActive(false);
-}
-
-/*!
-    Sets \a widget as the internal widget of this subwindow. The
-    internal widget is displayed in the center of the subwindow
-    beneath the title bar.
-
-    QMdiSubWindow takes temporary ownership of \a widget; you do
-    not have to delete it. Any existing internal widget will be
-    removed and reparented to the root window.
-
-    \sa widget()
-*/
-void QMdiSubWindow::setWidget(QWidget *widget)
-{
-    Q_D(QMdiSubWindow);
-    if (!widget) {
-        d->removeBaseWidget();
-        return;
-    }
-
-    if (widget == d->baseWidget) {
-        qWarning("QMdiSubWindow::setWidget: widget is already set");
-        return;
-    }
-
-    bool wasResized = testAttribute(Qt::WA_Resized);
-    d->removeBaseWidget();
-
-    if (QLayout *layout = this->layout())
-        layout->addWidget(widget);
-    else
-        widget->setParent(this);
-
-#ifndef QT_NO_SIZEGRIP
-    QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>();
-    if (sizeGrip)
-        sizeGrip->installEventFilter(this);
-    if (d->sizeGrip)
-        d->sizeGrip->raise();
-#endif
-
-    d->baseWidget = widget;
-    d->baseWidget->installEventFilter(this);
-
-    d->ignoreWindowTitleChange = true;
-    bool isWindowModified = this->isWindowModified();
-    if (windowTitle().isEmpty()) {
-        d->updateWindowTitle(true);
-        isWindowModified = d->baseWidget->isWindowModified();
-    }
-    if (!this->isWindowModified() && isWindowModified
-            && windowTitle().contains(QLatin1String("[*]"))) {
-        setWindowModified(isWindowModified);
-    }
-    d->lastChildWindowTitle = d->baseWidget->windowTitle();
-    d->ignoreWindowTitleChange = false;
-
-    if (windowIcon().isNull() && !d->baseWidget->windowIcon().isNull())
-        setWindowIcon(d->baseWidget->windowIcon());
-
-    d->updateGeometryConstraints();
-    if (!wasResized && testAttribute(Qt::WA_Resized))
-        setAttribute(Qt::WA_Resized, false);
-}
-
-/*!
-    Returns the current internal widget.
-
-    \sa setWidget()
-*/
-QWidget *QMdiSubWindow::widget() const
-{
-    return d_func()->baseWidget;
-}
-
-
-/*!
-    \internal
-*/
-QWidget *QMdiSubWindow::maximizedButtonsWidget() const
-{
-    Q_D(const QMdiSubWindow);
-    if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized()
-        && !isChildOfTabbedQMdiArea(this)) {
-        return d->controlContainer->controllerWidget();
-    }
-    return 0;
-}
-
-/*!
-    \internal
-*/
-QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const
-{
-    Q_D(const QMdiSubWindow);
-    if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized()
-        && !isChildOfTabbedQMdiArea(this)) {
-        return d->controlContainer->systemMenuLabel();
-    }
-    return 0;
-}
-
-/*!
-    Returns true if this window is shaded; otherwise returns false.
-
-    A window is shaded if it is collapsed so that only the title bar is
-    visible.
-*/
-bool QMdiSubWindow::isShaded() const
-{
-    return d_func()->isShadeMode;
-}
-
-/*!
-    If \a on is true, \a option is enabled on the subwindow; otherwise it is
-    disabled. See SubWindowOption for the effect of each option.
-
-    \sa SubWindowOption, testOption()
-*/
-void QMdiSubWindow::setOption(SubWindowOption option, bool on)
-{
-    Q_D(QMdiSubWindow);
-    if (on && !(d->options & option))
-        d->options |= option;
-    else if (!on && (d->options & option))
-        d->options &= ~option;
-
-#ifndef QT_NO_RUBBERBAND
-    if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode)
-        d->leaveRubberBandMode();
-#endif
-}
-
-/*!
-    Returns true if \a option is enabled; otherwise returns false.
-
-    \sa SubWindowOption, setOption()
-*/
-bool QMdiSubWindow::testOption(SubWindowOption option) const
-{
-    return d_func()->options & option;
-}
-
-/*!
-    \property QMdiSubWindow::keyboardSingleStep
-    \brief sets how far a widget should move or resize when using the
-    keyboard arrow keys.
-
-    When in keyboard-interactive mode, you can use the arrow and page keys to
-    either move or resize the window. This property controls the arrow keys.
-    The common way to enter keyboard interactive mode is to enter the
-    subwindow menu, and select either "resize" or "move".
-
-    The default keyboard single step value is 5 pixels.
-
-    \sa keyboardPageStep
-*/
-int QMdiSubWindow::keyboardSingleStep() const
-{
-    return d_func()->keyboardSingleStep;
-}
-
-void QMdiSubWindow::setKeyboardSingleStep(int step)
-{
-    // Haven't done any boundary check here since negative step only
-    // means inverted behavior, which is OK if the user want it.
-    // A step equal to zero means "do nothing".
-    d_func()->keyboardSingleStep = step;
-}
-
-/*!
-    \property QMdiSubWindow::keyboardPageStep
-    \brief sets how far a widget should move or resize when using the
-    keyboard page keys.
-
-    When in keyboard-interactive mode, you can use the arrow and page keys to
-    either move or resize the window. This property controls the page
-    keys. The common way to enter keyboard interactive mode is to enter the
-    subwindow menu, and select either "resize" or "move".
-
-    The default keyboard page step value is 20 pixels.
-
-    \sa keyboardSingleStep
-*/
-int QMdiSubWindow::keyboardPageStep() const
-{
-    return d_func()->keyboardPageStep;
-}
-
-void QMdiSubWindow::setKeyboardPageStep(int step)
-{
-    // Haven't done any boundary check here since negative step only
-    // means inverted behavior, which is OK if the user want it.
-    // A step equal to zero means "do nothing".
-    d_func()->keyboardPageStep = step;
-}
-
-#ifndef QT_NO_MENU
-/*!
-    Sets \a systemMenu as the current system menu for this subwindow.
-
-    By default, each QMdiSubWindow has a standard system menu.
-
-    QActions for the system menu created by QMdiSubWindow will
-    automatically be updated depending on the current window state;
-    e.g., the minimize action will be disabled after the window is
-    minimized.
-
-    QActions added by the user are not updated by QMdiSubWindow.
-
-    QMdiSubWindow takes ownership of \a systemMenu; you do not have to
-    delete it. Any existing menus will be deleted.
-
-    \sa systemMenu(), showSystemMenu()
-*/
-void QMdiSubWindow::setSystemMenu(QMenu *systemMenu)
-{
-    Q_D(QMdiSubWindow);
-    if (systemMenu && systemMenu == d->systemMenu) {
-        qWarning("QMdiSubWindow::setSystemMenu: system menu is already set");
-        return;
-    }
-
-    if (d->systemMenu) {
-        delete d->systemMenu;
-        d->systemMenu = 0;
-    }
-
-    if (!systemMenu)
-        return;
-
-    if (systemMenu->parent() != this)
-        systemMenu->setParent(this);
-    d->systemMenu = systemMenu;
-}
-
-/*!
-    Returns a pointer to the current system menu, or zero if no system
-    menu is set. QMdiSubWindow provides a default system menu, but you can
-    also set the menu with setSystemMenu().
-
-    \sa setSystemMenu(), showSystemMenu()
-*/
-QMenu *QMdiSubWindow::systemMenu() const
-{
-    return d_func()->systemMenu;
-}
-
-/*!
-    Shows the system menu below the system menu icon in the title bar.
-
-    \sa setSystemMenu(), systemMenu()
-*/
-void QMdiSubWindow::showSystemMenu()
-{
-    Q_D(QMdiSubWindow);
-    if (!d->systemMenu)
-        return;
-
-    QPoint globalPopupPos;
-    if (QWidget *icon = maximizedSystemMenuIconWidget()) {
-        if (isLeftToRight())
-            globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height()));
-        else
-            globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height()));
-    } else {
-        if (isLeftToRight())
-            globalPopupPos = mapToGlobal(contentsRect().topLeft());
-        else // + QPoint(1, 0) because topRight() == QPoint(left() + width() -1, top())
-            globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0);
-    }
-
-    // Adjust x() with -menuwidth in reverse mode.
-    if (isRightToLeft())
-        globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0);
-    d->systemMenu->installEventFilter(this);
-    d->systemMenu->popup(globalPopupPos);
-}
-#endif // QT_NO_MENU
-
-/*!
-    \since 4.4
-
-    Returns the area containing this sub-window, or 0 if there is none.
-
-    \sa QMdiArea::addSubWindow()
-*/
-QMdiArea *QMdiSubWindow::mdiArea() const
-{
-    QWidget *parent = parentWidget();
-    while (parent) {
-        if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)) {
-            if (area->viewport() == parentWidget())
-                return area;
-        }
-        parent = parent->parentWidget();
-    }
-    return 0;
-}
-
-/*!
-    Calling this function makes the subwindow enter the shaded mode.
-    When the subwindow is shaded, only the title bar is visible.
-
-    Although shading is not supported by all styles, this function will
-    still show the subwindow as shaded, regardless of whether support
-    for shading is available. However, when used with styles without
-    shading support, the user will be unable to return from shaded mode
-    through the user interface (e.g., through a shade button in the title
-    bar).
-
-    \sa isShaded()
-*/
-void QMdiSubWindow::showShaded()
-{
-    if (!parent())
-        return;
-
-    Q_D(QMdiSubWindow);
-    // setMinimizeMode uses this function.
-    if (!d->isShadeRequestFromMinimizeMode && isShaded())
-        return;
-
-    d->isMaximizeMode = false;
-
-    QWidget *currentFocusWidget = QApplication::focusWidget();
-    if (!d->restoreFocusWidget && isAncestorOf(currentFocusWidget))
-        d->restoreFocusWidget = currentFocusWidget;
-
-    if (!d->isShadeRequestFromMinimizeMode) {
-        d->isShadeMode = true;
-        d->ensureWindowState(Qt::WindowMinimized);
-    }
-
-#ifndef QT_NO_MENUBAR
-    d->removeButtonsFromMenuBar();
-#endif
-
-    // showMinimized() will reset Qt::WindowActive, which makes sense
-    // for top level widgets, but in MDI it makes sense to have an
-    // active window which is minimized.
-    if (hasFocus() || isAncestorOf(currentFocusWidget))
-        d->ensureWindowState(Qt::WindowActive);
-
-#ifndef QT_NO_SIZEGRIP
-    d->setSizeGripVisible(false);
-#endif
-
-    if (!d->restoreSize.isValid() || d->isShadeMode) {
-        d->oldGeometry = geometry();
-        d->restoreSize.setWidth(d->oldGeometry.width());
-        d->restoreSize.setHeight(d->oldGeometry.height());
-    }
-
-    // Hide the window before we change the geometry to avoid multiple resize
-    // events and wrong window state.
-    const bool wasVisible = isVisible();
-    if (wasVisible)
-        setVisible(false);
-
-    d->updateGeometryConstraints();
-    // Update minimum size to internalMinimumSize if set by user.
-    if (!minimumSize().isNull()) {
-        d->userMinimumSize = minimumSize();
-        setMinimumSize(d->internalMinimumSize);
-    }
-    resize(d->internalMinimumSize);
-
-    // Hide the internal widget if not already hidden by the user.
-    if (d->baseWidget && !d->baseWidget->isHidden()) {
-        d->baseWidget->hide();
-        d->isWidgetHiddenByUs = true;
-    }
-
-    if (wasVisible)
-        setVisible(true);
-
-    d->setFocusWidget();
-    d->resizeEnabled = false;
-    d->moveEnabled = true;
-    d->updateDirtyRegions();
-    d->updateMask();
-
-#ifndef QT_NO_ACTION
-    d->setEnabled(QMdiSubWindowPrivate::MinimizeAction, false);
-    d->setEnabled(QMdiSubWindowPrivate::ResizeAction, d->resizeEnabled);
-    d->setEnabled(QMdiSubWindowPrivate::MaximizeAction, true);
-    d->setEnabled(QMdiSubWindowPrivate::RestoreAction, true);
-    d->setEnabled(QMdiSubWindowPrivate::MoveAction, d->moveEnabled);
-#endif
-}
-
-/*!
-    \reimp
-*/
-bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
-{
-    Q_D(QMdiSubWindow);
-    if (!object)
-        return QWidget::eventFilter(object, event);
-
-#ifndef QT_NO_MENU
-    // System menu events.
-    if (d->systemMenu && d->systemMenu == object) {
-        if (event->type() == QEvent::MouseButtonDblClick) {
-            close();
-        } else if (event->type() == QEvent::MouseMove) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
-            d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos()));
-        } else if (event->type() == QEvent::Hide) {
-            d->systemMenu->removeEventFilter(this);
-            d->activeSubControl = QStyle::SC_None;
-            update(QRegion(0, 0, width(), d->titleBarHeight()));
-        }
-        return QWidget::eventFilter(object, event);
-    }
-#endif
-
-#ifndef QT_NO_SIZEGRIP
-    if (object != d->baseWidget && parent() && qobject_cast<QSizeGrip *>(object)) {
-        if (event->type() != QEvent::MouseButtonPress || !testOption(QMdiSubWindow::RubberBandResize))
-            return QWidget::eventFilter(object, event);
-        const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
-        d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPos());
-        d->oldGeometry = geometry();
-        d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize
-                                              : QMdiSubWindowPrivate::BottomLeftResize;
-#ifndef QT_NO_RUBBERBAND
-        d->enterRubberBandMode();
-#endif
-        return true;
-    }
-#endif
-
-    if (object != d->baseWidget && event->type() != QEvent::WindowTitleChange)
-        return QWidget::eventFilter(object, event);
-
-    switch (event->type()) {
-    case QEvent::Show:
-        d->setActive(true);
-        break;
-    case QEvent::ShowToParent:
-        if (!d->isWidgetHiddenByUs)
-            show();
-        break;
-    case QEvent::WindowStateChange: {
-        QWindowStateChangeEvent *changeEvent = static_cast<QWindowStateChangeEvent*>(event);
-        if (changeEvent->isOverride())
-            break;
-        Qt::WindowStates oldState = changeEvent->oldState();
-        Qt::WindowStates newState = d->baseWidget->windowState();
-        if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized))
-            showMinimized();
-        else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
-            showMaximized();
-        else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
-            showNormal();
-        break;
-    }
-    case QEvent::Enter:
-        d->currentOperation = QMdiSubWindowPrivate::None;
-        d->updateCursor();
-        break;
-    case QEvent::LayoutRequest:
-        d->updateGeometryConstraints();
-        break;
-    case QEvent::WindowTitleChange:
-        if (d->ignoreWindowTitleChange)
-            break;
-        if (object == d->baseWidget) {
-            d->updateWindowTitle(true);
-            d->lastChildWindowTitle = d->baseWidget->windowTitle();
-#ifndef QT_NO_MENUBAR
-        } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
-                   ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
-            d->originalTitle = QString();
-            if (d->baseWidget && d->baseWidget->windowTitle() == windowTitle())
-                d->updateWindowTitle(true);
-            else
-                d->updateWindowTitle(false);
-#endif
-        }
-        break;
-    case QEvent::ModifiedChange: {
-        if (object != d->baseWidget)
-            break;
-        bool windowModified = d->baseWidget->isWindowModified();
-        if (!windowModified && d->baseWidget->windowTitle() != windowTitle())
-            break;
-        if (windowTitle().contains(QLatin1String("[*]")))
-            setWindowModified(windowModified);
-        break;
-    }
-    default:
-        break;
-    }
-    return QWidget::eventFilter(object, event);
-}
-
-/*!
-    \reimp
-*/
-bool QMdiSubWindow::event(QEvent *event)
-{
-    Q_D(QMdiSubWindow);
-    switch (event->type()) {
-    case QEvent::StyleChange: {
-        bool wasShaded = isShaded();
-        bool wasMinimized = isMinimized();
-        bool wasMaximized = isMaximized();
-        // Don't emit subWindowActivated, the app doesn't have to know about our hacks
-        const QScopedValueRollback<bool> activationEnabledSaver(d->activationEnabled);
-        d->activationEnabled = false;
-
-        ensurePolished();
-        setContentsMargins(0, 0, 0, 0);
-        if (wasMinimized || wasMaximized || wasShaded)
-            showNormal();
-        d->updateGeometryConstraints();
-        resize(d->internalMinimumSize.expandedTo(size()));
-        d->updateMask();
-        d->updateDirtyRegions();
-        if (wasShaded)
-            showShaded();
-        else if (wasMinimized)
-            showMinimized();
-        else if (wasMaximized)
-            showMaximized();
-        break;
-    }
-    case QEvent::ParentAboutToChange:
-        d->setActive(false);
-        break;
-    case QEvent::ParentChange: {
-        bool wasResized = testAttribute(Qt::WA_Resized);
-#ifndef QT_NO_MENUBAR
-        d->removeButtonsFromMenuBar();
-#endif
-        d->currentOperation = QMdiSubWindowPrivate::None;
-        d->activeSubControl = QStyle::SC_None;
-        d->hoveredSubControl = QStyle::SC_None;
-#ifndef QT_NO_RUBBERBAND
-        if (d->isInRubberBandMode)
-            d->leaveRubberBandMode();
-#endif
-        d->isShadeMode = false;
-        d->isMaximizeMode = false;
-        d->isWidgetHiddenByUs = false;
-        if (!parent()) {
-            setOption(RubberBandResize, false);
-            setOption(RubberBandMove, false);
-        } else {
-            d->setWindowFlags(windowFlags());
-        }
-        setContentsMargins(0, 0, 0, 0);
-        d->updateGeometryConstraints();
-        d->updateCursor();
-        d->updateMask();
-        d->updateDirtyRegions();
-        d->updateActions();
-        if (!wasResized && testAttribute(Qt::WA_Resized))
-            setAttribute(Qt::WA_Resized, false);
-        break;
-    }
-    case QEvent::WindowActivate:
-        if (d->ignoreNextActivationEvent) {
-            d->ignoreNextActivationEvent = false;
-            break;
-        }
-        d->isExplicitlyDeactivated = false;
-        d->setActive(true);
-        break;
-    case QEvent::WindowDeactivate:
-        if (d->ignoreNextActivationEvent) {
-            d->ignoreNextActivationEvent = false;
-            break;
-        }
-        d->isExplicitlyDeactivated = true;
-        d->setActive(false);
-        break;
-    case QEvent::WindowTitleChange:
-        if (!d->ignoreWindowTitleChange)
-            d->updateWindowTitle(false);
-        d->updateInternalWindowTitle();
-        break;
-    case QEvent::ModifiedChange:
-        if (!windowTitle().contains(QLatin1String("[*]")))
-            break;
-#ifndef QT_NO_MENUBAR
-        if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
-                ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
-            window()->setWindowModified(isWindowModified());
-        }
-#endif // QT_NO_MENUBAR
-        d->updateInternalWindowTitle();
-        break;
-    case QEvent::LayoutDirectionChange:
-        d->updateDirtyRegions();
-        break;
-    case QEvent::LayoutRequest:
-        d->updateGeometryConstraints();
-        break;
-    case QEvent::WindowIconChange:
-        d->menuIcon = windowIcon();
-        if (d->menuIcon.isNull())
-            d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
-        if (d->controlContainer)
-            d->controlContainer->updateWindowIcon(d->menuIcon);
-        if (!maximizedSystemMenuIconWidget())
-            update(0, 0, width(), d->titleBarHeight());
-        break;
-    case QEvent::PaletteChange:
-        d->titleBarPalette = d->desktopPalette();
-        break;
-    case QEvent::FontChange:
-        d->font = font();
-        break;
-#ifndef QT_NO_TOOLTIP
-    case QEvent::ToolTip:
-        showToolTip(static_cast<QHelpEvent *>(event), this, d->titleBarOptions(),
-                    QStyle::CC_TitleBar, d->hoveredSubControl);
-        break;
-#endif
-    default:
-        break;
-    }
-    return QWidget::event(event);
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::showEvent(QShowEvent *showEvent)
-{
-    Q_D(QMdiSubWindow);
-    if (!parent()) {
-        QWidget::showEvent(showEvent);
-        return;
-    }
-
-    d->updateDirtyRegions();
-    // Show buttons in the menu bar if they're already not there.
-    // We want to do this when QMdiSubWindow becomes visible after being hidden.
-#ifndef QT_NO_MENUBAR
-    if (d->controlContainer) {
-        if (QMenuBar *menuBar = d->menuBar()) {
-            if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
-                d->showButtonsInMenuBar(menuBar);
-        }
-    }
-#endif
-    d->setActive(true);
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/)
-{
-#ifndef QT_NO_MENUBAR
-    d_func()->removeButtonsFromMenuBar();
-#endif
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::changeEvent(QEvent *changeEvent)
-{
-    if (!parent()) {
-        QWidget::changeEvent(changeEvent);
-        return;
-    }
-
-    if (changeEvent->type() != QEvent::WindowStateChange) {
-        QWidget::changeEvent(changeEvent);
-        return;
-    }
-
-    QWindowStateChangeEvent *event = static_cast<QWindowStateChangeEvent *>(changeEvent);
-    if (event->isOverride()) {
-        event->ignore();
-        return;
-    }
-
-    Qt::WindowStates oldState = event->oldState();
-    Qt::WindowStates newState = windowState();
-    if (oldState == newState) {
-        changeEvent->ignore();
-        return;
-    }
-
-    // QWidget ensures that the widget is visible _after_ setWindowState(),
-    // but we need to ensure that the widget is visible _before_
-    // setWindowState() returns.
-    Q_D(QMdiSubWindow);
-    if (!isVisible()) {
-        d->ensureWindowState(Qt::WindowNoState);
-        setVisible(true);
-    }
-
-    if (!d->oldGeometry.isValid())
-        d->oldGeometry = geometry();
-
-    if ((oldState & Qt::WindowActive) && (newState & Qt::WindowActive))
-        d->currentOperation = QMdiSubWindowPrivate::None;
-
-    if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized))
-        d->setMinimizeMode();
-    else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized))
-        d->setMaximizeMode();
-    else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized)))
-        d->setNormalMode();
-
-    if (d->isActive)
-        d->ensureWindowState(Qt::WindowActive);
-    if (d->activationEnabled)
-        emit windowStateChanged(oldState, windowState());
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
-{
-    Q_D(QMdiSubWindow);
-    bool acceptClose = true;
-    if (d->baseWidget)
-        acceptClose = d->baseWidget->close();
-    if (!acceptClose) {
-        closeEvent->ignore();
-        return;
-    }
-#ifndef QT_NO_MENUBAR
-    d->removeButtonsFromMenuBar();
-#endif
-    d->setActive(false);
-    if (parentWidget() && testAttribute(Qt::WA_DeleteOnClose)) {
-        QChildEvent childRemoved(QEvent::ChildRemoved, this);
-        QApplication::sendEvent(parentWidget(), &childRemoved);
-    }
-    closeEvent->accept();
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::leaveEvent(QEvent * /*leaveEvent*/)
-{
-    Q_D(QMdiSubWindow);
-    if (d->hoveredSubControl != QStyle::SC_None) {
-        d->hoveredSubControl = QStyle::SC_None;
-        update(QRegion(0, 0, width(), d->titleBarHeight()));
-    }
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::resizeEvent(QResizeEvent *resizeEvent)
-{
-    Q_D(QMdiSubWindow);
-#ifndef QT_NO_SIZEGRIP
-    if (d->sizeGrip) {
-        d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0,
-                          height() - d->sizeGrip->height());
-    }
-#endif
-
-    if (!parent()) {
-        QWidget::resizeEvent(resizeEvent);
-        return;
-    }
-
-    if (d->isMaximizeMode)
-        d->ensureWindowState(Qt::WindowMaximized);
-
-    d->updateMask();
-    if (!isVisible())
-        return;
-
-    if (d->resizeTimerId <= 0)
-        d->cachedStyleOptions = d->titleBarOptions();
-    else
-        killTimer(d->resizeTimerId);
-    d->resizeTimerId = startTimer(200);
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::timerEvent(QTimerEvent *timerEvent)
-{
-    Q_D(QMdiSubWindow);
-    if (timerEvent->timerId() == d->resizeTimerId) {
-        killTimer(d->resizeTimerId);
-        d->resizeTimerId = -1;
-        d->updateDirtyRegions();
-    }
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::moveEvent(QMoveEvent *moveEvent)
-{
-    if (!parent()) {
-        QWidget::moveEvent(moveEvent);
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    if (d->isMaximizeMode)
-        d->ensureWindowState(Qt::WindowMaximized);
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
-{
-    if (!parent() || (windowFlags() & Qt::FramelessWindowHint)) {
-        QWidget::paintEvent(paintEvent);
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    if (isMaximized() && !d->drawTitleBarWhenMaximized())
-        return;
-
-    if (d->resizeTimerId != -1) {
-        // Only update the style option rect and the window title.
-        int border = d->hasBorder(d->cachedStyleOptions) ? 4 : 0;
-        int titleBarHeight = d->titleBarHeight(d->cachedStyleOptions);
-        titleBarHeight -= isMinimized() ? 2 * border : border;
-        d->cachedStyleOptions.rect = QRect(border, border, width() - 2 * border, titleBarHeight);
-        if (!d->windowTitle.isEmpty()) {
-            int width = style()->subControlRect(QStyle::CC_TitleBar, &d->cachedStyleOptions,
-                                                QStyle::SC_TitleBarLabel, this).width();
-            d->cachedStyleOptions.text = d->cachedStyleOptions.fontMetrics
-                                         .elidedText(d->windowTitle, Qt::ElideRight, width);
-        }
-    } else {
-        // Force full update.
-        d->cachedStyleOptions = d->titleBarOptions();
-    }
-
-    QStylePainter painter(this);
-    if (!d->windowTitle.isEmpty())
-        painter.setFont(d->font);
-    painter.drawComplexControl(QStyle::CC_TitleBar, d->cachedStyleOptions);
-
-    if (isMinimized() && !d->hasBorder(d->cachedStyleOptions))
-        return;
-
-    QStyleOptionFrame frameOptions;
-    frameOptions.initFrom(this);
-    frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
-    if (d->isActive)
-        frameOptions.state |= QStyle::State_Active;
-    else
-        frameOptions.state &= ~QStyle::State_Active;
-
-    // ### Ensure that we do not require setting the cliprect for 4.4
-    if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions))
-        painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0));
-    if (!isMinimized() || d->hasBorder(d->cachedStyleOptions))
-        painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions);
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
-{
-    if (!parent()) {
-        QWidget::mousePressEvent(mouseEvent);
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    if (d->isInInteractiveMode)
-        d->leaveInteractiveMode();
-#ifndef QT_NO_RUBBERBAND
-    if (d->isInRubberBandMode)
-        d->leaveRubberBandMode();
-#endif
-
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-
-    if (d->currentOperation != QMdiSubWindowPrivate::None) {
-        d->updateCursor();
-        d->mousePressPosition = mapToParent(mouseEvent->pos());
-        if (d->resizeEnabled || d->moveEnabled)
-            d->oldGeometry = geometry();
-#ifndef QT_NO_RUBBERBAND
-        if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation())
-            || (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) {
-            d->enterRubberBandMode();
-        }
-#endif
-        return;
-    }
-
-    d->activeSubControl = d->hoveredSubControl;
-#ifndef QT_NO_MENU
-    if (d->activeSubControl == QStyle::SC_TitleBarSysMenu)
-        showSystemMenu();
-    else
-#endif
-    update(QRegion(0, 0, width(), d->titleBarHeight()));
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent *mouseEvent)
-{
-    if (!parent()) {
-        QWidget::mouseDoubleClickEvent(mouseEvent);
-        return;
-    }
-
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    if (!d->isMoveOperation()) {
-#ifndef QT_NO_MENU
-        if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu)
-            close();
-#endif
-        return;
-    }
-
-    Qt::WindowFlags flags = windowFlags();
-    if (isMinimized()) {
-        if ((isShaded() && (flags & Qt::WindowShadeButtonHint))
-            || (flags & Qt::WindowMinimizeButtonHint)) {
-            showNormal();
-        }
-        return;
-    }
-
-    if (isMaximized()) {
-       if (flags & Qt::WindowMaximizeButtonHint)
-           showNormal();
-       return;
-    }
-
-    if (flags & Qt::WindowShadeButtonHint)
-        showShaded();
-    else if (flags & Qt::WindowMaximizeButtonHint)
-        showMaximized();
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent)
-{
-    if (!parent()) {
-        QWidget::mouseReleaseEvent(mouseEvent);
-        return;
-    }
-
-    if (mouseEvent->button() != Qt::LeftButton) {
-        mouseEvent->ignore();
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    if (d->currentOperation != QMdiSubWindowPrivate::None) {
-#ifndef QT_NO_RUBBERBAND
-        if (d->isInRubberBandMode && !d->isInInteractiveMode)
-            d->leaveRubberBandMode();
-#endif
-        if (d->resizeEnabled || d->moveEnabled)
-            d->oldGeometry = geometry();
-    }
-
-    d->currentOperation = d->getOperation(mouseEvent->pos());
-    d->updateCursor();
-
-    d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
-    if (d->activeSubControl != QStyle::SC_None
-            && d->activeSubControl == d->hoveredSubControl) {
-        d->processClickedSubControl();
-    }
-    d->activeSubControl = QStyle::SC_None;
-    update(QRegion(0, 0, width(), d->titleBarHeight()));
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
-{
-    if (!parent()) {
-        QWidget::mouseMoveEvent(mouseEvent);
-        return;
-    }
-
-    Q_D(QMdiSubWindow);
-    // No update needed if we're in a move/resize operation.
-    if (!d->isMoveOperation() && !d->isResizeOperation()) {
-        // Find previous and current hover region.
-        const QStyleOptionTitleBar options = d->titleBarOptions();
-        QStyle::SubControl oldHover = d->hoveredSubControl;
-        d->hoveredSubControl = d->getSubControl(mouseEvent->pos());
-        QRegion hoverRegion;
-        if (isHoverControl(oldHover) && oldHover != d->hoveredSubControl)
-            hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this);
-        if (isHoverControl(d->hoveredSubControl) && d->hoveredSubControl != oldHover) {
-            hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
-                    d->hoveredSubControl, this);
-        }
-        if (!hoverRegion.isEmpty())
-            update(hoverRegion);
-    }
-
-    if ((mouseEvent->buttons() & Qt::LeftButton) || d->isInInteractiveMode) {
-        if ((d->isResizeOperation() && d->resizeEnabled) || (d->isMoveOperation() && d->moveEnabled))
-            d->setNewGeometry(mapToParent(mouseEvent->pos()));
-        return;
-    }
-
-    // Do not resize/move if not allowed.
-    d->currentOperation = d->getOperation(mouseEvent->pos());
-    if ((d->isResizeOperation() && !d->resizeEnabled) || (d->isMoveOperation() && !d->moveEnabled))
-        d->currentOperation = QMdiSubWindowPrivate::None;
-    d->updateCursor();
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent)
-{
-    Q_D(QMdiSubWindow);
-    if (!d->isInInteractiveMode || !parent()) {
-        keyEvent->ignore();
-        return;
-    }
-
-    QPoint delta;
-    switch (keyEvent->key()) {
-    case Qt::Key_Right:
-        if (keyEvent->modifiers() & Qt::ShiftModifier)
-            delta = QPoint(d->keyboardPageStep, 0);
-        else
-            delta = QPoint(d->keyboardSingleStep, 0);
-        break;
-    case Qt::Key_Up:
-        if (keyEvent->modifiers() & Qt::ShiftModifier)
-            delta = QPoint(0, -d->keyboardPageStep);
-        else
-            delta = QPoint(0, -d->keyboardSingleStep);
-        break;
-    case Qt::Key_Left:
-        if (keyEvent->modifiers() & Qt::ShiftModifier)
-            delta = QPoint(-d->keyboardPageStep, 0);
-        else
-            delta = QPoint(-d->keyboardSingleStep, 0);
-        break;
-    case Qt::Key_Down:
-        if (keyEvent->modifiers() & Qt::ShiftModifier)
-            delta = QPoint(0, d->keyboardPageStep);
-        else
-            delta = QPoint(0, d->keyboardSingleStep);
-        break;
-    case Qt::Key_Escape:
-    case Qt::Key_Return:
-    case Qt::Key_Enter:
-        d->leaveInteractiveMode();
-        return;
-    default:
-        keyEvent->ignore();
-        return;
-    }
-
-#ifndef QT_NO_CURSOR
-    QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta);
-    QRect oldGeometry =
-#ifndef QT_NO_RUBBERBAND
-        d->isInRubberBandMode ? d->rubberBand->geometry() :
-#endif
-        geometry();
-    d->setNewGeometry(newPosition);
-    QRect currentGeometry =
-#ifndef QT_NO_RUBBERBAND
-        d->isInRubberBandMode ? d->rubberBand->geometry() :
-#endif
-        geometry();
-    if (currentGeometry == oldGeometry)
-        return;
-
-    // Update cursor position
-
-    QPoint actualDelta;
-    if (d->isMoveOperation()) {
-        actualDelta = QPoint(currentGeometry.x() - oldGeometry.x(),
-                             currentGeometry.y() - oldGeometry.y());
-    } else {
-        int dx = isLeftToRight() ? currentGeometry.width() - oldGeometry.width()
-                                 : currentGeometry.x() - oldGeometry.x();
-        actualDelta = QPoint(dx, currentGeometry.height() - oldGeometry.height());
-    }
-
-    // Adjust in case we weren't able to move as long as wanted.
-    if (actualDelta != delta)
-        newPosition += (actualDelta - delta);
-    cursor().setPos(parentWidget()->mapToGlobal(newPosition));
-#endif
-}
-
-#ifndef QT_NO_CONTEXTMENU
-/*!
-    \reimp
-*/
-void QMdiSubWindow::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
-{
-    Q_D(QMdiSubWindow);
-    if (!d->systemMenu) {
-        contextMenuEvent->ignore();
-        return;
-    }
-
-    if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu
-            || d->getRegion(QMdiSubWindowPrivate::Move).contains(contextMenuEvent->pos())) {
-        d->systemMenu->exec(contextMenuEvent->globalPos());
-    } else {
-        contextMenuEvent->ignore();
-    }
-}
-#endif // QT_NO_CONTEXTMENU
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::focusInEvent(QFocusEvent *focusInEvent)
-{
-    d_func()->focusInReason = focusInEvent->reason();
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::focusOutEvent(QFocusEvent * /*focusOutEvent*/)
-{
-    // To avoid update() in QWidget::focusOutEvent.
-}
-
-/*!
-    \reimp
-*/
-void QMdiSubWindow::childEvent(QChildEvent *childEvent)
-{
-    if (childEvent->type() != QEvent::ChildPolished)
-        return;
-#ifndef QT_NO_SIZEGRIP
-    if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child()))
-        d_func()->setSizeGrip(sizeGrip);
-#endif
-}
-
-/*!
-    \reimp
-*/
-QSize QMdiSubWindow::sizeHint() const
-{
-    Q_D(const QMdiSubWindow);
-    int margin, minWidth;
-    d->sizeParameters(&margin, &minWidth);
-    QSize size(2 * margin, d->titleBarHeight() + margin);
-    if (d->baseWidget && d->baseWidget->sizeHint().isValid())
-        size += d->baseWidget->sizeHint();
-    return size.expandedTo(minimumSizeHint());
-}
-
-/*!
-    \reimp
-*/
-QSize QMdiSubWindow::minimumSizeHint() const
-{
-    Q_D(const QMdiSubWindow);
-    if (isVisible())
-        ensurePolished();
-
-    // Minimized window.
-    if (parent() && isMinimized() && !isShaded())
-        return d->iconSize();
-
-    // Calculate window decoration.
-    int margin, minWidth;
-    d->sizeParameters(&margin, &minWidth);
-    int decorationHeight = margin + d->titleBarHeight();
-    int minHeight = decorationHeight;
-
-    // Shaded window.
-    if (parent() && isShaded())
-        return QSize(qMax(minWidth, width()), d->titleBarHeight());
-
-    // Content
-    if (layout()) {
-        QSize minLayoutSize = layout()->minimumSize();
-        if (minLayoutSize.isValid()) {
-            minWidth = qMax(minWidth, minLayoutSize.width() + 2 * margin);
-            minHeight += minLayoutSize.height();
-        }
-    } else if (d->baseWidget && d->baseWidget->isVisible()) {
-        QSize minBaseWidgetSize = d->baseWidget->minimumSizeHint();
-        if (minBaseWidgetSize.isValid()) {
-            minWidth = qMax(minWidth, minBaseWidgetSize.width() + 2 * margin);
-            minHeight += minBaseWidgetSize.height();
-        }
-    }
-
-#ifndef QT_NO_SIZEGRIP
-    // SizeGrip
-    int sizeGripHeight = 0;
-    if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
-        sizeGripHeight = d->sizeGrip->height();
-    minHeight = qMax(minHeight, decorationHeight + sizeGripHeight);
-#endif
-
-    return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qmdisubwindow.cpp"
-#include "moc_qmdisubwindow.h"
-
-#endif //QT_NO_MDIAREA
-
-
diff --git a/src/gui/widgets/qmdisubwindow.h b/src/gui/widgets/qmdisubwindow.h
deleted file mode 100644 (file)
index 150dfe6..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMDISUBWINDOW_H
-#define QMDISUBWINDOW_H
-
-#include <QtGui/qwidget.h>
-
-#ifndef QT_NO_MDIAREA
-
-QT_BEGIN_NAMESPACE
-
-class QMenu;
-class QMdiArea;
-
-namespace QMdi { class ControlContainer; }
-class QMdiSubWindowPrivate;
-class Q_GUI_EXPORT QMdiSubWindow : public QWidget
-{
-    Q_OBJECT
-    Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep)
-    Q_PROPERTY(int keyboardPageStep READ keyboardPageStep WRITE setKeyboardPageStep)
-public:
-    enum SubWindowOption {
-        AllowOutsideAreaHorizontally = 0x1, // internal
-        AllowOutsideAreaVertically = 0x2, // internal
-        RubberBandResize = 0x4,
-        RubberBandMove = 0x8
-    };
-    Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption)
-
-    QMdiSubWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
-    ~QMdiSubWindow();
-
-    QSize sizeHint() const;
-    QSize minimumSizeHint() const;
-
-    void setWidget(QWidget *widget);
-    QWidget *widget() const;
-
-    QWidget *maximizedButtonsWidget() const; // internal
-    QWidget *maximizedSystemMenuIconWidget() const; // internal
-
-    bool isShaded() const;
-
-    void setOption(SubWindowOption option, bool on = true);
-    bool testOption(SubWindowOption) const;
-
-    void setKeyboardSingleStep(int step);
-    int keyboardSingleStep() const;
-
-    void setKeyboardPageStep(int step);
-    int keyboardPageStep() const;
-
-#ifndef QT_NO_MENU
-    void setSystemMenu(QMenu *systemMenu);
-    QMenu *systemMenu() const;
-#endif
-
-    QMdiArea *mdiArea() const;
-
-Q_SIGNALS:
-    void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
-    void aboutToActivate();
-
-public Q_SLOTS:
-#ifndef QT_NO_MENU
-    void showSystemMenu();
-#endif
-    void showShaded();
-
-protected:
-    bool eventFilter(QObject *object, QEvent *event);
-    bool event(QEvent *event);
-    void showEvent(QShowEvent *showEvent);
-    void hideEvent(QHideEvent *hideEvent);
-    void changeEvent(QEvent *changeEvent);
-    void closeEvent(QCloseEvent *closeEvent);
-    void leaveEvent(QEvent *leaveEvent);
-    void resizeEvent(QResizeEvent *resizeEvent);
-    void timerEvent(QTimerEvent *timerEvent);
-    void moveEvent(QMoveEvent *moveEvent);
-    void paintEvent(QPaintEvent *paintEvent);
-    void mousePressEvent(QMouseEvent *mouseEvent);
-    void mouseDoubleClickEvent(QMouseEvent *mouseEvent);
-    void mouseReleaseEvent(QMouseEvent *mouseEvent);
-    void mouseMoveEvent(QMouseEvent *mouseEvent);
-    void keyPressEvent(QKeyEvent *keyEvent);
-#ifndef QT_NO_CONTEXTMENU
-    void contextMenuEvent(QContextMenuEvent *contextMenuEvent);
-#endif
-    void focusInEvent(QFocusEvent *focusInEvent);
-    void focusOutEvent(QFocusEvent *focusOutEvent);
-    void childEvent(QChildEvent *childEvent);
-
-private:
-    Q_DISABLE_COPY(QMdiSubWindow)
-    Q_DECLARE_PRIVATE(QMdiSubWindow)
-    Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint())
-    Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode())
-    Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *))
-    friend class QMdiAreaPrivate;
-#ifndef QT_NO_TABBAR
-    friend class QMdiAreaTabBar;
-#endif
-    friend class QMdi::ControlContainer;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions)
-
-QT_END_NAMESPACE
-
-
-#endif // QT_NO_MDIAREA
-
-#endif // QMDISUBWINDOW_H
diff --git a/src/gui/widgets/qmdisubwindow_p.h b/src/gui/widgets/qmdisubwindow_p.h
deleted file mode 100644 (file)
index 24d3e59..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtGui module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMDISUBWINDOW_P_H
-#define QMDISUBWINDOW_P_H
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the Katie API.  It exists purely as an
-// implementation detail.  This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qmdisubwindow.h"
-
-#ifndef QT_NO_MDIAREA
-
-#include <QStyle>
-#include <QStyleOption>
-#include <QMenuBar>
-#include <QSizeGrip>
-#include <QPointer>
-#include <QDebug>
-#include "qwidget_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QVBoxLayout;
-class QMouseEvent;
-
-namespace QMdi {
-template<typename T>
-class ControlElement : public T
-{
-public:
-    ControlElement(QMdiSubWindow *child) : T(child, 0)
-    {
-        Q_ASSERT(child);
-        mdiChild = child;
-    }
-
-    void *qt_metacast(const char *classname)
-    {
-        if (classname && strcmp(classname, "ControlElement") == 0)
-            return this;
-        return 0;
-    }
-
-    QPointer<QMdiSubWindow> mdiChild;
-};
-
-class ControlContainer : public QObject
-{
-public:
-    ControlContainer(QMdiSubWindow *mdiChild);
-    ~ControlContainer();
-
-#ifndef QT_NO_MENUBAR
-    void showButtonsInMenuBar(QMenuBar *menuBar);
-    void removeButtonsFromMenuBar(QMenuBar *menuBar = 0);
-    QMenuBar *menuBar() const { return m_menuBar; }
-#endif
-    void updateWindowIcon(const QIcon &windowIcon);
-    QWidget *controllerWidget() const { return m_controllerWidget; }
-    QWidget *systemMenuLabel() const { return m_menuLabel; }
-
-private:
-    QPointer<QWidget> previousLeft;
-    QPointer<QWidget> previousRight;
-#ifndef QT_NO_MENUBAR
-    QPointer<QMenuBar> m_menuBar;
-#endif
-    QPointer<QWidget> m_controllerWidget;
-    QPointer<QWidget> m_menuLabel;
-    QPointer<QMdiSubWindow> mdiChild;
-};
-} // namespace QMdi
-
-class QMdiSubWindowPrivate : public QWidgetPrivate
-{
-    Q_DECLARE_PUBLIC(QMdiSubWindow)
-public:
-    // Enums and typedefs.
-    enum Operation {
-        None,
-        Move,
-        TopResize,
-        BottomResize,
-        LeftResize,
-        RightResize,
-        TopLeftResize,
-        TopRightResize,
-        BottomLeftResize,
-        BottomRightResize
-    };
-
-    enum ChangeFlag {
-        HMove = 0x01,
-        VMove = 0x02,
-        HResize = 0x04,
-        VResize = 0x08,
-        HResizeReverse = 0x10,
-        VResizeReverse = 0x20
-    };
-
-    enum WindowStateAction {
-        RestoreAction,
-        MoveAction,
-        ResizeAction,
-        MinimizeAction,
-        MaximizeAction,
-        StayOnTopAction,
-        CloseAction,
-        /* Add new states _above_ this line! */
-        NumWindowStateActions
-    };
-
-    struct OperationInfo {
-        uint changeFlags;
-        Qt::CursorShape cursorShape;
-        QRegion region;
-        bool hover;
-        OperationInfo(uint changeFlags, Qt::CursorShape cursorShape, bool hover = true)
-            : changeFlags(changeFlags),
-              cursorShape(cursorShape),
-              hover(hover)
-        {}
-    };
-
-    typedef QMap<Operation, OperationInfo> OperationInfoMap;
-
-    QMdiSubWindowPrivate();
-
-    // Variables.
-    QPointer<QWidget> baseWidget;
-    QPointer<QWidget> restoreFocusWidget;
-    QPointer<QMdi::ControlContainer> controlContainer;
-#ifndef QT_NO_SIZEGRIP
-    QPointer<QSizeGrip> sizeGrip;
-#endif
-#ifndef QT_NO_RUBBERBAND
-    QRubberBand *rubberBand;
-#endif
-    QPoint mousePressPosition;
-    QRect oldGeometry;
-    QSize internalMinimumSize;
-    QSize userMinimumSize;
-    QSize restoreSize;
-    bool resizeEnabled;
-    bool moveEnabled;
-    bool isInInteractiveMode;
-#ifndef QT_NO_RUBBERBAND
-    bool isInRubberBandMode;
-#endif
-    bool isShadeMode;
-    bool ignoreWindowTitleChange;
-    bool ignoreNextActivationEvent;
-    bool activationEnabled;
-    bool isShadeRequestFromMinimizeMode;
-    bool isMaximizeMode;
-    bool isWidgetHiddenByUs;
-    bool isActive;
-    bool isExplicitlyDeactivated;
-    int keyboardSingleStep;
-    int keyboardPageStep;
-    int resizeTimerId;
-    Operation currentOperation;
-    QStyle::SubControl hoveredSubControl;
-    QStyle::SubControl activeSubControl;
-    Qt::FocusReason focusInReason;
-    OperationInfoMap operationMap;
-    QPointer<QMenu> systemMenu;
-#ifndef QT_NO_ACTION
-    QPointer<QAction> actions[NumWindowStateActions];
-#endif
-    QMdiSubWindow::SubWindowOptions options;
-    QString lastChildWindowTitle;
-    QPalette titleBarPalette;
-    QString windowTitle;
-    QFont font;
-    QIcon menuIcon;
-    QStyleOptionTitleBar cachedStyleOptions;
-    QString originalTitle;
-
-    // Slots.
-    void _q_updateStaysOnTopHint();
-    void _q_enterInteractiveMode();
-    void _q_processFocusChanged(QWidget *old, QWidget *now);
-
-    // Functions.
-    void leaveInteractiveMode();
-    void removeBaseWidget();
-    void initOperationMap();
-#ifndef QT_NO_MENU
-    void createSystemMenu();
-#endif
-    void updateCursor();
-    void updateDirtyRegions();
-    void updateGeometryConstraints();
-    void updateMask();
-    void setNewGeometry(const QPoint &pos);
-    void setMinimizeMode();
-    void setNormalMode();
-    void setMaximizeMode();
-    void setActive(bool activate, bool changeFocus = true);
-    void processClickedSubControl();
-    QRegion getRegion(Operation operation) const;
-    Operation getOperation(const QPoint &pos) const;
-    QStyleOptionTitleBar titleBarOptions() const;
-    void ensureWindowState(Qt::WindowState state);
-    int titleBarHeight(const QStyleOptionTitleBar &options) const;
-    void sizeParameters(int *margin, int *minWidth) const;
-    bool drawTitleBarWhenMaximized() const;
-#ifndef QT_NO_MENUBAR
-    QMenuBar *menuBar() const;
-    void showButtonsInMenuBar(QMenuBar *menuBar);
-    void removeButtonsFromMenuBar();
-#endif
-    void updateWindowTitle(bool requestFromChild);
-#ifndef QT_NO_RUBBERBAND
-    void enterRubberBandMode();
-    void leaveRubberBandMode();
-#endif
-    QPalette desktopPalette() const;
-    void updateActions();
-    void setFocusWidget();
-    void restoreFocus();
-    void setWindowFlags(Qt::WindowFlags windowFlags);
-    void setVisible(WindowStateAction, bool visible = true);
-#ifndef QT_NO_ACTION
-    void setEnabled(WindowStateAction, bool enable = true);
-#ifndef QT_NO_MENU
-    void addToSystemMenu(WindowStateAction, const QString &text, const char *slot);
-#endif
-#endif // QT_NO_ACTION
-    QSize iconSize() const;
-#ifndef QT_NO_SIZEGRIP
-    void setSizeGrip(QSizeGrip *sizeGrip);
-    void setSizeGripVisible(bool visible = true) const;
-#endif
-    void updateInternalWindowTitle();
-    QString originalWindowTitle();
-    void setNewWindowTitle();
-
-    inline int titleBarHeight() const
-    {
-        Q_Q(const QMdiSubWindow);
-        if (!parent || q->windowFlags() & Qt::FramelessWindowHint
-            || (q->isMaximized() && !drawTitleBarWhenMaximized())) {
-            return 0;
-        }
-        QStyleOptionTitleBar options = titleBarOptions();
-        int height = options.rect.height();
-        if (hasBorder(options))
-            height += q->isMinimized() ? 8 : 4;
-        return height;
-    }
-
-    inline QStyle::SubControl getSubControl(const QPoint &pos) const
-    {
-        Q_Q(const QMdiSubWindow);
-        QStyleOptionTitleBar titleBarOptions = this->titleBarOptions();
-        return q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &titleBarOptions, pos, q);
-    }
-
-    inline void setNewGeometry(QRect *geometry)
-    {
-        Q_Q(QMdiSubWindow);
-        Q_ASSERT(parent);
-        geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
-#ifndef QT_NO_RUBBERBAND
-        if (isInRubberBandMode)
-            rubberBand->setGeometry(*geometry);
-        else
-#endif
-            q->setGeometry(*geometry);
-    }
-
-    inline bool hasBorder(const QStyleOptionTitleBar &options) const
-    {
-        Q_Q(const QMdiSubWindow);
-        return !q->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, q);
-    }
-
-    inline bool autoRaise() const
-    {
-        Q_Q(const QMdiSubWindow);
-        return q->style()->styleHint(QStyle::SH_TitleBar_AutoRaise, 0, q);
-    }
-
-    inline bool isResizeOperation() const
-    {
-        return currentOperation != None && currentOperation != Move;
-    }
-
-    inline bool isMoveOperation() const
-    {
-        return currentOperation == Move;
-    }
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_MDIAREA
-
-#endif // QMDISUBWINDOW_P_H
index 71a47e9..9ca3349 100644 (file)
@@ -25,7 +25,6 @@
 #include <QBoxLayout>
 #include <QPainter>
 #include <QPen>
-#include <QMdiSubWindow>
 
 QT_BEGIN_NAMESPACE
 
@@ -38,9 +37,8 @@ PreviewFrame::PreviewFrame(QWidget *parent)
 
     QVBoxLayout *vbox = new QVBoxLayout(this);
     vbox->setMargin(0);
-    previewWidget = new PreviewWidget;
-    workspace = new Workspace(this);
-    vbox->addWidget(workspace);
+    previewWidget = new PreviewWidget();
+    vbox->addWidget(previewWidget);
     previewWidget->setAutoFillBackground(true);
 }
 
@@ -49,37 +47,10 @@ void PreviewFrame::setPreviewPalette(const QPalette &pal)
     previewWidget->setPalette(pal);
 }
 
-QString PreviewFrame::previewText() const
-{
-    return m_previewWindowText;
-}
 
 void PreviewFrame::setPreviewVisible(bool visible)
 {
     previewWidget->parentWidget()->setVisible(visible);
-    if (visible)
-        m_previewWindowText = QLatin1String("The moose in the noose\nate the goose who was loose.");
-    else
-        m_previewWindowText = tr("Desktop settings will only take effect after an application restart.");
-    workspace->viewport()->update();
-}
-
-Workspace::Workspace(PreviewFrame *parent)
-    : QMdiArea(parent)
-{
-    previewFrame = parent;
-    PreviewWidget *previewWidget = previewFrame->widget();
-    QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window);
-    frame->move(10, 10);
-    frame->show();
-}
-
-void Workspace::paintEvent(QPaintEvent *)
-{
-    QPainter p(viewport());
-    p.fillRect(rect(), palette().color(backgroundRole()).dark());
-    p.setPen(QPen(Qt::white));
-    p.drawText(0, height() / 2,  width(), height(), Qt::AlignHCenter, previewFrame->previewText());
 }
 
 #include "moc_previewframe.h"
index 5de2604..bb51486 100644 (file)
 #ifndef PREVIEWFRAME_H
 #define PREVIEWFRAME_H
 
-#include <QMdiArea>
+#include <QFrame>
 
 QT_BEGIN_NAMESPACE
 
-class PreviewFrame;
-class Workspace : public QMdiArea
-{
-    Q_OBJECT
-
-public:
-    Workspace(PreviewFrame *parent = 0);
-    ~Workspace() {}
-
-protected:
-    void paintEvent(QPaintEvent *);
-private:
-    PreviewFrame *previewFrame;
-};
-
 class PreviewWidget;
 class PreviewFrame : public QFrame
 {
     Q_OBJECT
-
 public:
     PreviewFrame(QWidget *parent = nullptr);
     void setPreviewPalette(const QPalette &pal);
     void setPreviewVisible(bool val);
-    QString previewText() const;
     PreviewWidget *widget() const { return previewWidget; }
 private:
-    Workspace *workspace;
     PreviewWidget *previewWidget;
-    QString m_previewWindowText;
 };
 
 QT_END_NAMESPACE
index 8c8793e..21286fe 100644 (file)
@@ -301,8 +301,6 @@ static const struct ClassTblData {
     { QLatin1String("QMapData"), QLatin1String("QtCore/qmap.h") },
     { QLatin1String("QMatrix"), QLatin1String("QtGui/qmatrix.h") },
     { QLatin1String("QMatrix4x4"), QLatin1String("QtGui/qmatrix4x4.h") },
-    { QLatin1String("QMdiArea"), QLatin1String("QtGui/qmdiarea.h") },
-    { QLatin1String("QMdiSubWindow"), QLatin1String("QtGui/qmdisubwindow.h") },
     { QLatin1String("QMenu"), QLatin1String("QtGui/qmenu.h") },
     { QLatin1String("QMenuBar"), QLatin1String("QtGui/qmenubar.h") },
     { QLatin1String("QMessageBox"), QLatin1String("QtGui/qmessagebox.h") },
index f62ecd2..3758234 100644 (file)
@@ -666,8 +666,6 @@ void WriteInitialization::acceptWidget(DomWidget *node)
         m_output << m_indent << parentWidget << "->setWidget(" << varName << ");\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QSplitter"))) {
         m_output << m_indent << parentWidget << "->addWidget(" << varName << ");\n";
-    } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QMdiArea"))) {
-        m_output << m_indent << parentWidget << "->addSubWindow(" << varName << ");\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QWizard"))) {
         addWizardPage(varName, node, parentWidget);
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QToolBox"))) {
index a034aed..11c618d 100644 (file)
@@ -255,7 +255,6 @@ bool Uic::isContainer(const QString &className) const
         || customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))
         || customWidgetsInfo()->extends(className, QLatin1String("QTabWidget"))
         || customWidgetsInfo()->extends(className, QLatin1String("QScrollArea"))
-        || customWidgetsInfo()->extends(className, QLatin1String("QMdiArea"))
         || customWidgetsInfo()->extends(className, QLatin1String("QWizard"))
         || customWidgetsInfo()->extends(className, QLatin1String("QDockWidget"));
 }
index 20c7a90..b2e5c1d 100644 (file)
@@ -69,7 +69,6 @@
 #include <QtGui/QToolBar>
 #include <QtGui/QMenuBar>
 #include <QtGui/QDockWidget>
-#include <QtGui/QMdiArea>
 #include <QtGui/QWizard>
 
 #include <limits.h>
@@ -538,13 +537,6 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
     }
 #endif
 
-#ifndef QT_NO_MDIAREA
-    else if (QMdiArea *mdiArea = qobject_cast<QMdiArea*>(parentWidget)) {
-        mdiArea->addSubWindow(widget);
-        return true;
-    }
-#endif
-
 #ifndef QT_NO_DOCKWIDGET
     else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget)) {
         dockWidget->setWidget(widget);
index bcb9b60..947342f 100644 (file)
@@ -115,9 +115,6 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
 #ifndef QT_NO_SCROLLAREA
             && !qobject_cast<QScrollArea *>(parentWidget)
 #endif
-#ifndef QT_NO_MDIAREA
-            && !qobject_cast<QMdiArea *>(parentWidget)
-#endif
 #ifndef QT_NO_DOCKWIDGET
             && !qobject_cast<QDockWidget *>(parentWidget)
 #endif
index 198478e..2401dff 100644 (file)
@@ -46,9 +46,6 @@ DECLARE_WIDGET(QListWidget, "")
 #ifndef QT_NO_MAINWINDOW
 DECLARE_WIDGET(QMainWindow, "")
 #endif
-#ifndef QT_NO_MDIAREA
-DECLARE_WIDGET(QMdiArea, "")
-#endif
 #ifndef QT_NO_MENU
 DECLARE_WIDGET(QMenu, "")
 #endif
index 9509d0a..004dce2 100644 (file)
@@ -45,7 +45,6 @@
 #include <qcombobox.h>
 #include <qradiobutton.h>
 #include <qlineedit.h>
-#include <qmdiarea.h>
 #include <qwidget.h>
 #include <qdebug.h>
 #include <qcleanlooksstyle.h>
index 81e1352..625bbdc 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-08-03 05:13+0300\n"
+"POT-Creation-Date: 2023-08-11 13:50+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -233,7 +233,7 @@ msgctxt "QJsonDocument"
 msgid "Unknown JSON type"
 msgstr ""
 
-#: src/core/tools/qjsondocument.cpp:199 src/core/tools/qjsondocument.cpp:301
+#: src/core/tools/qjsondocument.cpp:199 src/core/tools/qjsondocument.cpp:323
 msgctxt "QJsonDocument"
 msgid "Rootless values are not supported"
 msgstr ""
@@ -248,12 +248,12 @@ msgctxt "QJsonDocument"
 msgid "Maximum depth reached"
 msgstr ""
 
-#: src/core/tools/qjsondocument.cpp:284 src/core/tools/qjsondocument.cpp:310
+#: src/core/tools/qjsondocument.cpp:306 src/core/tools/qjsondocument.cpp:332
 msgctxt "QJsonDocument"
 msgid "Unknown variant type"
 msgstr ""
 
-#: src/core/tools/qjsondocument.cpp:306
+#: src/core/tools/qjsondocument.cpp:328
 msgctxt "QJsonDocument"
 msgid "Rootless arrays are not supported"
 msgstr ""
@@ -1125,7 +1125,7 @@ msgstr ""
 msgid "Cancel"
 msgstr ""
 
-#: src/gui/dialogs/qwizard.cpp:591 src/gui/widgets/qmdisubwindow.cpp:312
+#: src/gui/dialogs/qwizard.cpp:591
 msgid "Help"
 msgstr ""
 
@@ -1276,7 +1276,7 @@ msgstr ""
 msgid "Font st&yle"
 msgstr ""
 
-#: src/gui/dialogs/qfontdialog.cpp:681 src/gui/widgets/qmdisubwindow.cpp:1016
+#: src/gui/dialogs/qfontdialog.cpp:681
 msgid "&Size"
 msgstr ""
 
@@ -1328,15 +1328,15 @@ msgstr ""
 msgid "Select Color"
 msgstr ""
 
-#: src/gui/dialogs/qcolordialog.cpp:1437
+#: src/gui/dialogs/qcolordialog.cpp:1436
 msgid "&Basic colors"
 msgstr ""
 
-#: src/gui/dialogs/qcolordialog.cpp:1438
+#: src/gui/dialogs/qcolordialog.cpp:1437
 msgid "&Custom colors"
 msgstr ""
 
-#: src/gui/dialogs/qcolordialog.cpp:1439
+#: src/gui/dialogs/qcolordialog.cpp:1438
 msgid "&Add to Custom Colors"
 msgstr ""
 
@@ -1884,74 +1884,6 @@ msgctxt "QDialogButtonBox"
 msgid "Restore Defaults"
 msgstr ""
 
-#: src/gui/widgets/qmdisubwindow.cpp:249
-msgid "- [%1]"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:250
-msgid "%1 - [%2]"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:291
-msgid "Minimize"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:294
-msgid "Maximize"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:297
-msgid "Unshade"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:300
-msgid "Shade"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:304
-msgid "Restore Down"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:306
-msgid "Restore"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:309
-msgid "Close"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:315
-msgid "Menu"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1012
-msgid "&Restore"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1015
-msgid "&Move"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1017
-msgid "Mi&nimize"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1019
-msgid "Ma&ximize"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1021
-msgid "Stay on &Top"
-msgstr ""
-
-#: src/gui/widgets/qmdisubwindow.cpp:1024
-msgid "&Close"
-msgstr ""
-
-#: src/gui/widgets/qmdiarea.cpp:251
-msgid "(Untitled)"
-msgstr ""
-
 #: src/gui/widgets/qmenubar.cpp:1500
 msgctxt "QMenuBar"
 msgid "Corner Toolbar"
@@ -3737,55 +3669,55 @@ msgctxt "QFormBuilder"
 msgid "The property %1 could not be written. The type %2 is not supported yet."
 msgstr ""
 
-#: src/uitools/formbuilder.cpp:140
+#: src/uitools/formbuilder.cpp:137
 msgctxt "QFormBuilder"
 msgid "An empty class name was passed on to %1 (object name: '%2')."
 msgstr ""
 
-#: src/uitools/formbuilder.cpp:194
+#: src/uitools/formbuilder.cpp:191
 msgctxt "QFormBuilder"
 msgid ""
 "QFormBuilder was unable to create a custom widget of the class '%1'; "
 "defaulting to base class '%2'."
 msgstr ""
 
-#: src/uitools/formbuilder.cpp:200
+#: src/uitools/formbuilder.cpp:197
 msgctxt "QFormBuilder"
 msgid "QFormBuilder was unable to create a widget of the class '%1'."
 msgstr ""
 
-#: src/uitools/formbuilder.cpp:241
+#: src/uitools/formbuilder.cpp:238
 msgctxt "QFormBuilder"
 msgid "The layout type `%1' is not supported."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:170
+#: src/uitools/abstractformbuilder.cpp:169
 msgctxt "QAbstractFormBuilder"
 msgid "Unexpected element <%1>"
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:175
+#: src/uitools/abstractformbuilder.cpp:174
 msgctxt "QAbstractFormBuilder"
 msgid ""
 "An error has occurred while reading the UI file at line %1, column %2: %3"
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:181
+#: src/uitools/abstractformbuilder.cpp:180
 msgctxt "QAbstractFormBuilder"
 msgid "Invalid UI file: The root element <ui> is missing."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:284
+#: src/uitools/abstractformbuilder.cpp:283
 msgctxt "QAbstractFormBuilder"
 msgid "The creation of a widget of the class '%1' failed."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:566
+#: src/uitools/abstractformbuilder.cpp:558
 msgctxt "QAbstractFormBuilder"
 msgid "Attempt to add child that is not of class QWizardPage to QWizard."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:628
+#: src/uitools/abstractformbuilder.cpp:620
 msgctxt "QAbstractFormBuilder"
 msgid ""
 "Attempt to add a layout to a widget '%1' (%2) which already has a layout of "
@@ -3793,22 +3725,22 @@ msgid ""
 "This indicates an inconsistency in the ui-file."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:834
+#: src/uitools/abstractformbuilder.cpp:826
 msgctxt "QAbstractFormBuilder"
 msgid "Empty widget item in %1 '%2'."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:1566
+#: src/uitools/abstractformbuilder.cpp:1558
 msgctxt "QAbstractFormBuilder"
 msgid "Flags property are not supported yet."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:1647
+#: src/uitools/abstractformbuilder.cpp:1639
 msgctxt "QAbstractFormBuilder"
 msgid "While applying tab stops: The widget '%1' could not be found."
 msgstr ""
 
-#: src/uitools/abstractformbuilder.cpp:2384
+#: src/uitools/abstractformbuilder.cpp:2376
 msgctxt "QAbstractFormBuilder"
 msgid "Invalid QButtonGroup reference '%1' referenced by '%2'."
 msgstr ""
index 42fa7c8..148cda1 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-08-03 05:13+0300\n"
+"POT-Creation-Date: 2023-08-11 13:50+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,10 +17,6 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/tools/qtconfig/previewframe.cpp:63
-msgid "Desktop settings will only take effect after an application restart."
-msgstr ""
-
 #: src/tools/qtconfig/mainwindow.cpp:57
 msgctxt "MainWindow"
 msgid ""
@@ -76,34 +72,34 @@ msgstr ""
 msgid "Unknown"
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:313
+#: src/tools/qtconfig/mainwindow.cpp:311
 msgid "No changes to be saved."
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:319
+#: src/tools/qtconfig/mainwindow.cpp:317
 msgid "Saving changes..."
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:387
+#: src/tools/qtconfig/mainwindow.cpp:385
 msgid "Saved changes."
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:509
+#: src/tools/qtconfig/mainwindow.cpp:507
 msgid ""
 "<h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2015 The Qt Company Ltd."
 "<br/><br/>Copyright (C) 2016 Ivailo Monev"
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:514 src/tools/qtconfig/mainwindow.cpp:515
-#: src/tools/qtconfig/mainwindow.cpp:522
+#: src/tools/qtconfig/mainwindow.cpp:512 src/tools/qtconfig/mainwindow.cpp:513
+#: src/tools/qtconfig/mainwindow.cpp:520
 msgid "Katie Configuration"
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:545
+#: src/tools/qtconfig/mainwindow.cpp:543
 msgid "Save Changes"
 msgstr ""
 
-#: src/tools/qtconfig/mainwindow.cpp:546
+#: src/tools/qtconfig/mainwindow.cpp:544
 msgid "Save changes to settings?"
 msgstr ""