Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 68315)
@@ -3670,9 +3670,5 @@
     const OverlayList & overlays = mDisplay.overlays();
     QRect overInter = overlaysRectIntersection();
-#if QT_VERSION >= 0x050000
     overInter = overInter.intersected(aRect);
-#else /* QT_VERSION < 0x050000 */
-    overInter = overInter.intersect(aRect);
-#endif /* QT_VERSION < 0x050000 */
 
     bool bDisplayPrimary = true;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp	(revision 68315)
@@ -20,28 +20,6 @@
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Qt includes: */
-# ifdef VBOX_WS_WIN
-#  include <QtGlobal> /* for QT_VERSION */
-#  if QT_VERSION < 0x050000
-#   include <QLibrary>
-#  endif
-# endif
-
 /* GUI includes: */
 # include "QILineEdit.h"
-
-/* Other VBox includes: */
-# ifdef VBOX_WS_WIN
-#  if QT_VERSION < 0x050000
-#   include "iprt/ldr.h"
-#  endif
-# endif
-
-/* External includes: */
-# ifdef VBOX_WS_WIN
-#  if QT_VERSION < 0x050000
-#   include <iprt/win/windows.h>
-#  endif
-# endif
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
@@ -49,9 +27,4 @@
 /* Qt includes: */
 #include <QStyleOptionFrame>
-#ifdef VBOX_WS_WIN
-# if QT_VERSION < 0x050000
-#  include <QWindowsVistaStyle>
-# endif
-#endif
 
 
@@ -81,25 +54,4 @@
     QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this);
 
-#ifdef VBOX_WS_WIN
-# if QT_VERSION < 0x050000
-    /* Vista l&f style has a bug where the last parameter of sizeFromContents
-     * function ('widget' what corresponds to 'this' in our class) is ignored.
-     * Due to it QLineEdit processed as QComboBox and size calculation includes
-     * non-existing combo-box button of 23 pix in width. So fixing it here: */
-    if (qobject_cast <QWindowsVistaStyle*> (style()))
-    {
-        /* Check if l&f style theme is really active else painting performed by
-         * Windows Classic theme and there is no such shifting error. */
-        typedef BOOL (WINAPI *PFNISAPPTHEMED)(VOID);
-        static PFNISAPPTHEMED s_pfnIsAppThemed = (PFNISAPPTHEMED)~(uintptr_t)0;
-        if (s_pfnIsAppThemed == (PFNISAPPTHEMED)~(uintptr_t)0 )
-            s_pfnIsAppThemed = (PFNISAPPTHEMED)RTLdrGetSystemSymbol("uxtheme.dll", "IsAppThemed");
-
-        if (s_pfnIsAppThemed && s_pfnIsAppThemed())
-            sa -= QSize(23, 0);
-    }
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_WIN */
-
     return sa;
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsView.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsView.cpp	(revision 68315)
@@ -52,9 +52,5 @@
             AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent));
             /* For touch-screen event we have something special: */
-#if QT_VERSION >= 0x050000
             if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen)
-#else /* QT_VERSION < 0x050000 */
-            if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)
-#endif /* QT_VERSION < 0x050000 */
             {
                 /* Remember where the scrolling was started: */
@@ -73,9 +69,5 @@
             AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent));
             /* For touch-screen event we have something special: */
-#if QT_VERSION >= 0x050000
             if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen)
-#else /* QT_VERSION < 0x050000 */
-            if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)
-#endif /* QT_VERSION < 0x050000 */
             {
                 /* Determine vertical shift (inverted): */
@@ -100,9 +92,5 @@
             AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent));
             /* For touch-screen event we have something special: */
-#if QT_VERSION >= 0x050000
             if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen)
-#else /* QT_VERSION < 0x050000 */
-            if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)
-#endif /* QT_VERSION < 0x050000 */
             {
                 /* Reset the scrolling start position: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 68315)
@@ -1538,7 +1538,5 @@
             {
                 /* Configure chooser-filter: */
-#if QT_VERSION >= 0x040700
                 m_pFilterOfChooser->setPlaceholderText("Search..");
-#endif /* QT_VERSION >= 0x040700 */
                 connect(m_pFilterOfChooser, SIGNAL(textChanged(const QString&)),
                         this, SLOT(sltChooserApplyFilter(const QString&)));
@@ -1605,7 +1603,5 @@
             {
                 /* Configure data-filter: */
-#if QT_VERSION >= 0x040700
                 m_pFilterOfData->setPlaceholderText("Search..");
-#endif /* QT_VERSION >= 0x040700 */
                 connect(m_pFilterOfData, SIGNAL(textChanged(const QString&)),
                         this, SLOT(sltDataApplyFilter(const QString&)));
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp	(revision 68315)
@@ -23,10 +23,8 @@
 # include <QApplication>
 # include <QDesktopWidget>
+# include <QScreen>
 # ifdef VBOX_WS_X11
 #  include <QTimer>
 # endif
-# if QT_VERSION >= 0x050000
-#  include <QScreen>
-# endif /* QT_VERSION >= 0x050000 */
 
 /* GUI includes: */
@@ -343,5 +341,5 @@
 }
 
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
 bool UIDesktopWidgetWatchdog::isFakeScreenDetected() const
 {
@@ -355,48 +353,5 @@
            || (qApp->screens().size() == 1 && qApp->screens().first()->name() == ":0.0");
 }
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
-
-#if QT_VERSION < 0x050000
-
-void UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(int cHostScreenCount)
-{
-//    printf("UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(%d)\n", cHostScreenCount);
-
-# ifdef VBOX_WS_X11
-    /* Update host-screen configuration: */
-    updateHostScreenConfiguration(cHostScreenCount);
-# endif /* VBOX_WS_X11 */
-
-    /* Notify listeners: */
-    emit sigHostScreenCountChanged(cHostScreenCount);
-}
-
-void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(int iHostScreenIndex)
-{
-//    printf("UIDesktopWidgetWatchdog::sltHandleHostScreenResized(%d)\n", iHostScreenIndex);
-
-# ifdef VBOX_WS_X11
-    /* Update host-screen available-geometry: */
-    updateHostScreenAvailableGeometry(iHostScreenIndex);
-# endif /* VBOX_WS_X11 */
-
-    /* Notify listeners: */
-    emit sigHostScreenResized(iHostScreenIndex);
-}
-
-void UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(int iHostScreenIndex)
-{
-//    printf("UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(%d)\n", iHostScreenIndex);
-
-# ifdef VBOX_WS_X11
-    /* Update host-screen available-geometry: */
-    updateHostScreenAvailableGeometry(iHostScreenIndex);
-# endif /* VBOX_WS_X11 */
-
-    /* Notify listeners: */
-    emit sigHostScreenWorkAreaResized(iHostScreenIndex);
-}
-
-#else /* QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
 void UIDesktopWidgetWatchdog::sltHostScreenAdded(QScreen *pHostScreen)
@@ -483,6 +438,4 @@
     emit sigHostScreenWorkAreaResized(iHostScreenIndex);
 }
-
-#endif /* QT_VERSION >= 0x050000 */
 
 #ifdef VBOX_WS_X11
@@ -512,12 +465,4 @@
 {
     /* Prepare connections: */
-#if QT_VERSION < 0x050000
-    connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,
-            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);
-    connect(QApplication::desktop(), &QDesktopWidget::resized,
-            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
-    connect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
-            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
-#else /* QT_VERSION >= 0x050000 */
     connect(qApp, &QGuiApplication::screenAdded,
             this, &UIDesktopWidgetWatchdog::sltHostScreenAdded);
@@ -531,5 +476,4 @@
                 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
     }
-#endif /* QT_VERSION >= 0x050000 */
 
 #ifdef VBOX_WS_X11
@@ -542,12 +486,4 @@
 {
     /* Cleanup connections: */
-#if QT_VERSION < 0x050000
-    disconnect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,
-               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);
-    disconnect(QApplication::desktop(), &QDesktopWidget::resized,
-               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
-    disconnect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
-               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
-#else /* QT_VERSION >= 0x050000 */
     disconnect(qApp, &QGuiApplication::screenAdded,
                this, &UIDesktopWidgetWatchdog::sltHostScreenAdded);
@@ -561,5 +497,4 @@
                    this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
     }
-#endif /* QT_VERSION >= 0x050000 */
 
 #ifdef VBOX_WS_X11
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h	(revision 68315)
@@ -101,8 +101,8 @@
     const QRegion overallAvailableRegion() const;
 
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
     /** Qt5: X11: Returns whether no or fake screen detected. */
     bool isFakeScreenDetected() const;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif
 
 private slots:
@@ -111,12 +111,5 @@
     /** Stupid moc does not warn if it cannot find headers! */
     void QT_VERSION_NOT_DEFINED
-#elif QT_VERSION < 0x050000
-    /** Handles host-screen count change to @a cHostScreenCount. */
-    void sltHandleHostScreenCountChanged(int cHostScreenCount);
-    /** Handles resize for the host-screen with @a iHostScreenIndex. */
-    void sltHandleHostScreenResized(int iHostScreenIndex);
-    /** Handles work-area resize for the host-screen with @a iHostScreenIndex. */
-    void sltHandleHostScreenWorkAreaResized(int iHostScreenIndex);
-#else /* QT_VERSION >= 0x050000 */
+#else
     /** Handles @a pHostScreen adding. */
     void sltHostScreenAdded(QScreen *pHostScreen);
@@ -127,5 +120,5 @@
     /** Handles host-screen work-area resize to passed @a availableGeometry. */
     void sltHandleHostScreenWorkAreaResized(const QRect &availableGeometry);
-#endif /* QT_VERSION >= 0x050000 */
+#endif
 
 #ifdef VBOX_WS_X11
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 68315)
@@ -24,7 +24,5 @@
 # include <QToolTip>
 # include <QTranslator>
-# if QT_VERSION >= 0x050000
 #  include <QStandardPaths>
-# endif /* QT_VERSION >= 0x050000 */
 # include <QDesktopServices>
 # include <QMutex>
@@ -48,8 +46,7 @@
 #  include <QTextStream>
 # endif /* VBOX_GUI_WITH_PIDFILE */
-# if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+# ifdef VBOX_WS_X11
 #  include <QScreen>
-#  include <xcb/xcb.h>
-# endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+# endif
 
 /* GUI includes: */
@@ -132,5 +129,8 @@
 # ifdef VBOX_WS_WIN
 #  include <iprt/win/shlobj.h>
-# endif /* VBOX_WS_WIN */
+# endif
+# ifdef VBOX_WS_X11
+#  include <xcb/xcb.h>
+# endif
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
@@ -1804,9 +1804,5 @@
 
     /* Try to load the corresponding Qt translation */
-#if QT_VERSION < 0x050000
-    if (sLoadedLangId != gVBoxBuiltInLangName)
-#else /* QT_VERSION >= 0x050000 */
     if (sLoadedLangId != gVBoxBuiltInLangName && sLoadedLangId != "en")
-#endif /* QT_VERSION >= 0x050000 */
     {
 #ifdef Q_OS_UNIX
@@ -3122,9 +3118,5 @@
 QString VBoxGlobal::documentsPath()
 {
-#if QT_VERSION >= 0x050000
     QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
-#else /* QT_VERSION < 0x050000 */
-    QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
-#endif /* QT_VERSION < 0x050000 */
     QDir dir(path);
     if (dir.exists())
@@ -3243,5 +3235,5 @@
 }
 
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
 typedef struct {
 /** User specified flags */
@@ -3266,5 +3258,5 @@
 uint32_t win_gravity;
 } xcb_size_hints_t;
-#endif /* defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
 /* static */
@@ -3272,5 +3264,5 @@
 {
     AssertPtrReturnVoid(pWidget);
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
 # define QWINDOWSIZE_MAX ((1<<24)-1)
     if (pWidget->isWindow() && pWidget->isVisible())
@@ -3320,7 +3312,7 @@
          * Configure event will arrive to tell Qt what geometry we want. */
         pWidget->setGeometry(x, y, w, h);
-# else /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
+# else /* !VBOX_WS_X11 */
     pWidget->setGeometry(x, y, w, h);
-# endif /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
+# endif /* !VBOX_WS_X11 */
 }
 
@@ -3654,19 +3646,11 @@
     QString vmNameOrUuid;
 
-#if QT_VERSION >= 0x050000
     const QStringList arguments = qApp->arguments();
     const int argc = arguments.size();
-#else /* QT_VERSION < 0x050000 */
-    int argc = qApp->argc();
-#endif /* QT_VERSION < 0x050000 */
     int i = 1;
     while (i < argc)
     {
-#if QT_VERSION >= 0x050000
         QByteArray  argBytes = arguments.at(i).toUtf8();
         const char *arg = argBytes.constData();
-#else /* QT_VERSION < 0x050000 */
-        const char *arg = qApp->argv() [i];
-#endif /* QT_VERSION < 0x050000 */
         /* NOTE: the check here must match the corresponding check for the
          * options to start a VM in main.cpp and hardenedmain.cpp exactly,
@@ -3677,9 +3661,5 @@
             if (++i < argc)
             {
-#if QT_VERSION >= 0x050000
                 vmNameOrUuid = arguments.at(i);
-#else /* QT_VERSION < 0x050000 */
-                vmNameOrUuid = QString (qApp->argv() [i]);
-#endif /* QT_VERSION < 0x050000 */
                 startVM = true;
             }
@@ -3693,9 +3673,5 @@
         {
             if (++i < argc)
-# if QT_VERSION >= 0x050000
                 m_strPidfile = arguments.at(i);
-# else /* QT_VERSION < 0x050000 */
-                m_strPidfile = QString(qApp->argv()[i]);
-# endif /* QT_VERSION < 0x050000 */
         }
 #endif /* VBOX_GUI_WITH_PIDFILE */
@@ -3714,9 +3690,5 @@
             if (++i < argc)
             {
-#if QT_VERSION >= 0x050000
                 RTStrCopy(mSettingsPw, sizeof(mSettingsPw), arguments.at(i).toLocal8Bit().constData());
-#else /* QT_VERSION < 0x050000 */
-                RTStrCopy(mSettingsPw, sizeof(mSettingsPw), qApp->argv() [i]);
-#endif /* QT_VERSION < 0x050000 */
                 mSettingsPwSet = true;
             }
@@ -3727,9 +3699,5 @@
             {
                 size_t cbFile;
-#if QT_VERSION >= 0x050000
                 const char *pszFile = arguments.at(i).toLocal8Bit().constData();
-#else /* QT_VERSION < 0x050000 */
-                char *pszFile = qApp->argv() [i];
-#endif /* QT_VERSION < 0x050000 */
                 bool fStdIn = !::strcmp(pszFile, "stdin");
                 int vrc = VINF_SUCCESS;
@@ -3775,18 +3743,10 @@
         {
             if (++i < argc)
-# if QT_VERSION >= 0x050000
                 m_strFloppyImage = arguments.at(i);
-# else /* QT_VERSION < 0x050000 */
-                m_strFloppyImage = qApp->argv()[i];
-# endif /* QT_VERSION < 0x050000 */
         }
         else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom"))
         {
             if (++i < argc)
-# if QT_VERSION >= 0x050000
                 m_strDvdImage = arguments.at(i);
-# else /* QT_VERSION < 0x050000 */
-                m_strDvdImage = qApp->argv()[i];
-# endif /* QT_VERSION < 0x050000 */
         }
         /* VMM Options: */
@@ -3806,9 +3766,5 @@
         {
             if (++i < argc)
-#if QT_VERSION >= 0x050000
                 mWarpPct = RTStrToUInt32(arguments.at(i).toLocal8Bit().constData());
-#else /* QT_VERSION < 0x050000 */
-                mWarpPct = RTStrToUInt32(qApp->argv() [i]);
-#endif /* QT_VERSION < 0x050000 */
         }
 #ifdef VBOX_WITH_DEBUGGER_GUI
Index: /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 68315)
@@ -53,9 +53,4 @@
 /* Qt includes: */
 #ifdef VBOX_WS_X11
-# ifdef Q_OS_SOLARIS
-#  if QT_VERSION < 0x050000
-#   include <QPlastiqueStyle>
-#  endif /* QT_VERSION < 0x050000 */
-# endif /* Q_OS_SOLARIS */
 # ifndef Q_OS_SOLARIS
 #  include <QFontDatabase>
@@ -228,5 +223,4 @@
 #endif /* VBOX_WS_X11 */
 
-#if QT_VERSION >= 0x050000
 /** Qt5 message handler, function that prints out
   * debug, warning, critical, fatal and system error messages.
@@ -272,42 +266,4 @@
     }
 }
-#else /* QT_VERSION < 0x050000 */
-/** Qt4 message handler, function that prints out
-  * debug, warning, critical, fatal and system error messages.
-  * @param  type  Holds the type of the message.
-  * @param  pMsg  Holds the message body. */
-static void QtMessageOutput(QtMsgType type, const char *pMsg)
-{
-# ifndef VBOX_WS_X11
-    NOREF(pMsg);
-# endif /* !VBOX_WS_X11 */
-    switch (type)
-    {
-        case QtDebugMsg:
-            Log(("Qt DEBUG: %s\n", pMsg));
-            break;
-        case QtWarningMsg:
-            Log(("Qt WARNING: %s\n", pMsg));
-# ifdef VBOX_WS_X11
-            /* Needed for instance for the message ``cannot connect to X server'': */
-            RTStrmPrintf(g_pStdErr, "Qt WARNING: %s\n", pMsg);
-# endif /* VBOX_WS_X11 */
-            break;
-        case QtCriticalMsg:
-            Log(("Qt CRITICAL: %s\n", pMsg));
-# ifdef VBOX_WS_X11
-            /* Needed for instance for the message ``cannot connect to X server'': */
-            RTStrmPrintf(g_pStdErr, "Qt CRITICAL: %s\n", pMsg);
-# endif /* VBOX_WS_X11 */
-            break;
-        case QtFatalMsg:
-            Log(("Qt FATAL: %s\n", pMsg));
-# ifdef VBOX_WS_X11
-            /* Needed for instance for the message ``cannot connect to X server'': */
-            RTStrmPrintf(g_pStdErr, "Qt FATAL: %s\n", pMsg);
-# endif /* VBOX_WS_X11 */
-    }
-}
-#endif /* QT_VERSION < 0x050000 */
 
 /** Shows all available command line parameters. */
@@ -439,11 +395,6 @@
 #endif /* VBOX_WS_X11 */
 
-#if QT_VERSION >= 0x050000
         /* Install Qt console message handler: */
         qInstallMessageHandler(QtMessageOutput);
-#else /* QT_VERSION < 0x050000 */
-        /* Install Qt console message handler: */
-        qInstallMsgHandler(QtMessageOutput);
-#endif /* QT_VERSION < 0x050000 */
 
         /* Create application: */
@@ -480,10 +431,5 @@
 
 # ifdef Q_OS_SOLARIS
-#  if QT_VERSION < 0x050000
-        /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
-        QApplication::setStyle(new QPlastiqueStyle);
-#  else /* QT_VERSION >= 0x050000 */
         a.setStyle("fusion");
-#  endif /* QT_VERSION >= 0x050000 */
 # endif /* Q_OS_SOLARIS */
 
@@ -496,9 +442,5 @@
         bool isSubScaleable = fontDataBase.isScalable(subFamily);
         if (isCurrentScaleable && !isSubScaleable)
-#  if QT_VERSION >= 0x050000
             QFont::removeSubstitutions(currentFamily);
-#  else /* QT_VERSION < 0x050000 */
-            QFont::removeSubstitution(currentFamily);
-#  endif /* QT_VERSION < 0x050000 */
 # endif /* !Q_OS_SOLARIS */
 
@@ -569,9 +511,9 @@
 int main(int argc, char **argv, char **envp)
 {
-#ifdef VBOX_WS_X11
+# ifdef VBOX_WS_X11
     /* Make sure multi-threaded environment is safe: */
     if (!MakeSureMultiThreadingIsSafe())
         return 1;
-#endif /* VBOX_WS_X11 */
+# endif /* VBOX_WS_X11 */
 
     /* Initialize VBox Runtime.
@@ -609,12 +551,7 @@
         Q_UNUSED(a);
 
-#ifdef Q_OS_SOLARIS
-# if QT_VERSION < 0x050000
-        /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
-        QApplication::setStyle(new QPlastiqueStyle);
-#else /* QT_VERSION >= 0x050000 */
+# ifdef Q_OS_SOLARIS
         a.setStyle("fusion");
-# endif /* QT_VERSION >= 0x050000 */
-#endif /* Q_OS_SOLARIS */
+# endif /* Q_OS_SOLARIS */
 
         /* Prepare the error-message: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp	(revision 68315)
@@ -1528,21 +1528,9 @@
         pTreeWidget->sortItems(0, Qt::AscendingOrder);
         if (iColumns > 0)
-#if QT_VERSION >= 0x050000
             pTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed);
-#else /* QT_VERSION < 0x050000 */
-            pTreeWidget->header()->setResizeMode(0, QHeaderView::Fixed);
-#endif /* QT_VERSION < 0x050000 */
         if (iColumns > 1)
-#if QT_VERSION >= 0x050000
             pTreeWidget->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
-#else /* QT_VERSION < 0x050000 */
-            pTreeWidget->header()->setResizeMode(1, QHeaderView::ResizeToContents);
-#endif /* QT_VERSION < 0x050000 */
         if (iColumns > 2)
-#if QT_VERSION >= 0x050000
             pTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
-#else /* QT_VERSION < 0x050000 */
-            pTreeWidget->header()->setResizeMode(2, QHeaderView::ResizeToContents);
-#endif /* QT_VERSION < 0x050000 */
         pTreeWidget->header()->setStretchLastSection(false);
         pTreeWidget->setSortingEnabled(true);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp	(revision 68315)
@@ -24,8 +24,6 @@
 # include <QDir>
 # include <QPointer>
-# if QT_VERSION >= 0x050000
-#  include <QUrl>
-#  include <QUrlQuery>
-# endif /* QT_VERSION >= 0x050000 */
+# include <QUrl>
+# include <QUrlQuery>
 
 /* GUI includes: */
@@ -181,9 +179,5 @@
     {
         /* Compose query: */
-#if QT_VERSION >= 0x050000
         QUrlQuery url;
-#else /* QT_VERSION < 0x050000 */
-        QUrl url(m_url);
-#endif /* QT_VERSION < 0x050000 */
         url.addQueryItem("platform", vboxGlobal().virtualBox().GetPackageType());
         /* Check if branding is active: */
@@ -209,11 +203,7 @@
         UserDictionary headers;
         headers["User-Agent"] = strUserAgent;
-#if QT_VERSION >= 0x050000
         QUrl fullUrl(m_url);
         fullUrl.setQuery(url);
         createNetworkRequest(UINetworkRequestType_GET, QList<QUrl>() << fullUrl, headers);
-#else /* QT_VERSION < 0x050000 */
-        createNetworkRequest(UINetworkRequestType_GET, QList<QUrl>() << url, headers);
-#endif /* QT_VERSION < 0x050000 */
     }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm	(revision 68315)
@@ -29,11 +29,9 @@
 #import <AppKit/NSImage.h>
 #import <AppKit/NSSegmentedControl.h>
-#if QT_VERSION >= 0x050000
-# import <AppKit/NSEvent.h>
-# import <AppKit/NSColor.h>
-# import <AppKit/NSSearchFieldCell.h>
-# import <AppKit/NSSearchField.h>
-# import <AppKit/NSSegmentedCell.h>
-#endif /* QT_VERSION >= 0x050000 */
+#import <AppKit/NSEvent.h>
+#import <AppKit/NSColor.h>
+#import <AppKit/NSSearchFieldCell.h>
+#import <AppKit/NSSearchField.h>
+#import <AppKit/NSSegmentedCell.h>
 
 /* Qt includes */
@@ -46,12 +44,4 @@
 /* Other VBox includes: */
 #include <iprt/assert.h>
-
-#if 0 /* This is a built-in according to clang. Not sure how it relates to QT_VERSION... */
-/* Interface Builder Constant,
- * hmm, where is it declared with Qt4? */
-#if QT_VERSION >= 0x050000
-# define IBAction void
-#endif /* QT_VERSION >= 0x050000 */
-#endif
 
 /* Forward declarations: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp	(revision 68315)
@@ -287,5 +287,5 @@
     const QEvent::Type type = pEvent->type();
 
-#if defined(VBOX_OSE) || (QT_VERSION < 0x040700)
+#ifdef VBOX_OSE // TODO: Do we still need it?
     /* Stupid Qt: Qt doesn't check if a window is minimized when a command is
      * executed. This leads to strange behaviour. The minimized window is
@@ -305,5 +305,5 @@
         }
     }
-#endif /* VBOX_OSE || QT_VERSION < 0x040700 */
+#endif /* VBOX_OSE */
 
     /* We need to track several events which leads to different window
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm	(revision 68315)
@@ -26,9 +26,7 @@
 #import <AppKit/NSColor.h>
 #import <AppKit/NSFont.h>
-#if QT_VERSION >= 0x050000
-# import <AppKit/NSScreen.h>
-# import <AppKit/NSWindow.h>
-# import <AppKit/NSImageView.h>
-#endif /* QT_VERSION >= 0x050000 */
+#import <AppKit/NSScreen.h>
+#import <AppKit/NSWindow.h>
+#import <AppKit/NSImageView.h>
 
 #import <objc/objc-class.h>
@@ -293,12 +291,4 @@
     return 1.0;
 }
-
-#if QT_VERSION < 0x050000
-void darwinSetDockIconMenu(QMenu* pMenu)
-{
-    extern void qt_mac_set_dock_menu(QMenu *);
-    qt_mac_set_dock_menu(pMenu);
-}
-#endif /* QT_VERSION < 0x050000 */
 
 /**
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp	(revision 68315)
@@ -30,7 +30,5 @@
 #include <QPixmap>
 #include <QContextMenuEvent>
-#if QT_VERSION >= 0x050000
-# include <QtMac>
-#endif /* QT_VERSION >= 0x050000 */
+#include <QtMac>
 
 #include <Carbon/Carbon.h>
@@ -329,9 +327,5 @@
                                               kCGImageAlphaPremultipliedFirst);
     /* Get the CGImageRef from Qt */
-#if QT_VERSION < 0x050000
-    CGImageRef qtPixmap = pPixmap->toMacCGImageRef();
-#else /* QT_VERSION >= 0x050000 */
     CGImageRef qtPixmap = QtMac::toCGImageRef(*pPixmap);
-#endif /* QT_VERSION >= 0x050000 */
     /* Draw the image from Qt & convert the context back to a new CGImageRef. */
     CGContextDrawImage(ctx, CGRectMake(0, 0, pPixmap->width(), pPixmap->height()), qtPixmap);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h	(revision 68315)
@@ -254,7 +254,4 @@
 void darwinSetShowsWindowTransparent(QWidget *pWidget, bool fEnabled);
 void darwinSetWindowHasShadow(QWidget *pWidget, bool fEnabled);
-#if QT_VERSION < 0x050000
-void darwinSetDockIconMenu(QMenu *pMenu);
-#endif /* QT_VERSION < 0x050000 */
 void darwinDisableIconsInMenus(void);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 68315)
@@ -425,11 +425,6 @@
     verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33));
     horizontalHeader()->setStretchLastSection(false);
-#if QT_VERSION >= 0x050000
     horizontalHeader()->setSectionResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive);
     horizontalHeader()->setSectionResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch);
-#else /* QT_VERSION < 0x050000 */
-    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive);
-    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch);
-#endif /* QT_VERSION < 0x050000 */
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp	(revision 68315)
@@ -287,5 +287,4 @@
 QTextStream *g_pStrmLogQt = NULL; /* Output stream for Qt debug logging. */
 
-# if QT_VERSION >= 0x050000
 /* static */
 void UIDnDHandler::debugOutputQt(QtMsgType type, const QMessageLogContext &context, const QString &strMessage)
@@ -312,32 +311,4 @@
         (*g_pStrmLogQt) << strMsg << " " << strMessage << endl;
 }
-# else /* QT_VERSION < 0x050000 */
-/* static */
-void UIDnDHandler::debugOutputQt(QtMsgType type, const char *pszMsg)
-{
-    AssertPtr(pszMsg);
-
-    QString strMsg;
-    switch (type)
-    {
-    case QtWarningMsg:
-        strMsg += "[W]";
-        break;
-    case QtCriticalMsg:
-        strMsg += "[C]";
-        break;
-    case QtFatalMsg:
-        strMsg += "[F]";
-        break;
-    case QtDebugMsg:
-    default:
-        strMsg += "[D]";
-        break;
-    }
-
-    if (g_pStrmLogQt)
-        (*g_pStrmLogQt) << strMsg << " " << pszMsg << endl;
-}
-# endif /* QT_VERSION < 0x050000 */
 #endif /* DEBUG_DND_QT */
 
@@ -367,9 +338,5 @@
         g_pStrmLogQt = new QTextStream(pFileDebugQt);
 
-#if QT_VERSION >= 0x050000
         qInstallMessageHandler(UIDnDHandler::debugOutputQt);
-#else /* QT_VERSION < 0x050000 */
-        qInstallMsgHandler(UIDnDHandler::debugOutputQt);
-#endif /* QT_VERSION < 0x050000 */
         qDebug("========================================================================");
     }
@@ -438,9 +405,5 @@
 #  ifdef RT_OS_DARWIN
 #    ifdef VBOX_WITH_DRAG_AND_DROP_PROMISES
-#     if QT_VERSION < 0x050000
-        dropAction = pDrag->exec(actions, defAction, true /* fUsePromises */);
-#     else /* QT_VERSION >= 0x050000 */
         dropAction = pDrag->exec(actions, defAction);
-#     endif /* QT_VERSION >= 0x050000 */
 #    else
         /* Without having VBOX_WITH_DRAG_AND_DROP_PROMISES enabled drag and drop
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 68315)
@@ -64,7 +64,5 @@
 # include <QX11Info>
 # include <X11/Xlib.h>
-# if QT_VERSION >= 0x050000
-#  undef Bool // Qt5 vs Xlib gift..
-# endif /* QT_VERSION >= 0x050000 */
+# undef Bool // Qt5 vs Xlib gift..
 #endif /* VBOX_WS_X11 */
 
@@ -1384,5 +1382,4 @@
 
 #ifdef VBOX_WS_MAC
-# if QT_VERSION >= 0x050000
     /* On OSX for Qt5 we need to erase backing store first: */
     QRect eraseRect = paintRect;
@@ -1397,5 +1394,4 @@
     painter.fillRect(eraseRect, QColor(Qt::black));
     painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC */
 
@@ -1470,5 +1466,4 @@
 
 #if defined(VBOX_WITH_TRANSLUCENT_SEAMLESS)
-# if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) || QT_VERSION >= 0x050000
     /* On OSX for Qt5 we need to erase backing store first: */
     QRect eraseRect = paintRect;
@@ -1483,5 +1478,4 @@
     painter.fillRect(eraseRect, QColor(Qt::black));
     painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
-# endif /* VBOX_WS_WIN || VBOX_WS_X11 || QT_VERSION >= 0x050000 */
 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp	(revision 68315)
@@ -37,9 +37,7 @@
 /* Qt includes: */
 # include <QKeyEvent>
+# include <QTimer>
 # ifdef VBOX_WS_X11
 #  include <QX11Info>
-# endif
-# if QT_VERSION >= 0x050000
-#   include <QTimer>
 # endif
 
@@ -70,7 +68,5 @@
 /* Other VBox includes: */
 # ifdef VBOX_WS_MAC
-#  if QT_VERSION >= 0x050000
-#   include "iprt/cpp/utils.h"
-#  endif /* QT_VERSION >= 0x050000 */
+#  include "iprt/cpp/utils.h"
 # endif /* VBOX_WS_MAC */
 
@@ -105,7 +101,5 @@
 #  undef FocusIn
 # endif /* KeyPress */
-# if QT_VERSION >= 0x050000
-#  include <xcb/xcb.h>
-# endif /* QT_VERSION >= 0x050000 */
+# include <xcb/xcb.h>
 #endif /* VBOX_WS_X11 */
 
@@ -212,40 +206,4 @@
 }
 
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-struct CHECKFORX11FOCUSEVENTSDATA
-{
-    Window hWindow;
-    bool fEventFound;
-};
-
-static Bool checkForX11FocusEventsWorker(Display *pDisplay, XEvent *pEvent,
-                                         XPointer pArg)
-{
-    NOREF(pDisplay);
-    struct CHECKFORX11FOCUSEVENTSDATA *pStruct;
-
-    pStruct = (struct CHECKFORX11FOCUSEVENTSDATA *)pArg;
-    if (   pEvent->xany.type == XFocusIn
-        || pEvent->xany.type == XFocusOut)
-        if (pEvent->xany.window == pStruct->hWindow)
-            pStruct->fEventFound = true;
-    return false;
-}
-
-bool UIKeyboardHandler::checkForX11FocusEvents(Window hWindow)
-{
-    XEvent dummy;
-    struct CHECKFORX11FOCUSEVENTSDATA data;
-
-    data.hWindow = hWindow;
-    data.fEventFound = false;
-    XCheckIfEvent(QX11Info::display(), &dummy, checkForX11FocusEventsWorker,
-                  (XPointer)&data);
-    return data.fEventFound;
-}
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
-
 void UIKeyboardHandler::captureKeyboard(ulong uScreenId)
 {
@@ -264,8 +222,4 @@
         m_iKeyboardCaptureViewIndex = uScreenId;
 
-#if QT_VERSION < 0x050000
-        /* Finalise keyboard capture: */
-        finaliseCaptureKeyboard();
-#else
         /* On X11, we do not grab the keyboard as soon as it is captured, but delay it
          * for 300 milliseconds after the formal capture. We do this for several reasons:
@@ -281,5 +235,4 @@
          *            common behavior everywhere while X11 is forced to behave that way. */
         QTimer::singleShot(300, this, SLOT(sltFinaliseCaptureKeyboard()));
-#endif
     }
 }
@@ -318,48 +271,4 @@
 
 #elif defined(VBOX_WS_X11)
-# if QT_VERSION < 0x050000
-
-        /* On X11, we are using passive XGrabKey for normal (windowed) mode
-         * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because
-         * XGrabKeyboard causes a problem under metacity - a window cannot be moved
-         * using the mouse if it is currently actively grabbing the keyboard;
-         * For static modes we are using usual (active) keyboard grabbing. */
-
-        switch (machineLogic()->visualStateType())
-        {
-            /* If window is moveable we are making passive keyboard grab: */
-            case UIVisualStateType_Normal:
-            case UIVisualStateType_Scale:
-            {
-                XGrabKey(QX11Info::display(), AnyKey, AnyModifier, m_windows[m_iKeyboardCaptureViewIndex]->winId(), False, GrabModeAsync, GrabModeAsync);
-                break;
-            }
-            /* If window is NOT moveable we are making active keyboard grab: */
-            case UIVisualStateType_Fullscreen:
-            case UIVisualStateType_Seamless:
-            {
-                /* Keyboard grabbing can fail because of some keyboard shortcut is still grabbed by window manager.
-                 * We can't be sure this shortcut will be released at all, so we will retry to grab keyboard for 50 times,
-                 * and after we will just ignore that issue: */
-                int cTriesLeft = 50;
-                Window hWindow;
-
-                /* Only do our keyboard grab if there are no other focus events
-                 * for this window on the queue.  This can prevent problems
-                 * including two windows fighting to grab the keyboard. */
-                hWindow = m_windows[m_iKeyboardCaptureViewIndex]->winId();
-                if (!checkForX11FocusEvents(hWindow))
-                    while (cTriesLeft && XGrabKeyboard(QX11Info::display(),
-                           hWindow, False, GrabModeAsync, GrabModeAsync,
-                           CurrentTime))
-                        --cTriesLeft;
-                break;
-            }
-            /* Should we try to grab keyboard in default case? I think - NO. */
-            default:
-                break;
-        }
-
-# else /* QT_VERSION >= 0x050000 */
 
         /* On X11, we are using XCB stuff to grab the keyboard.
@@ -398,5 +307,4 @@
         free(pGrabReply);
 
-# endif /* QT_VERSION >= 0x050000 */
 #else
 
@@ -451,34 +359,4 @@
 
 #elif defined(VBOX_WS_X11)
-# if QT_VERSION < 0x050000
-
-        /* On X11, we are using passive XGrabKey for normal (windowed) mode
-         * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because
-         * XGrabKeyboard causes a problem under metacity - a window cannot be moved
-         * using the mouse if it is currently actively grabbing the keyboard;
-         * For static modes we are using usual (active) keyboard grabbing. */
-
-        switch (machineLogic()->visualStateType())
-        {
-            /* If window is moveable we are making passive keyboard ungrab: */
-            case UIVisualStateType_Normal:
-            case UIVisualStateType_Scale:
-            {
-                XUngrabKey(QX11Info::display(), AnyKey, AnyModifier, m_windows[m_iKeyboardCaptureViewIndex]->winId());
-                break;
-            }
-            /* If window is NOT moveable we are making active keyboard ungrab: */
-            case UIVisualStateType_Fullscreen:
-            case UIVisualStateType_Seamless:
-            {
-                XUngrabKeyboard(QX11Info::display(), CurrentTime);
-                break;
-            }
-            /* Should we try to release keyboard in default case? I think - NO. */
-            default:
-                break;
-        }
-
-# else /* QT_VERSION >= 0x050000 */
 
         /* On X11, we are using XCB stuff to grab the keyboard.
@@ -496,5 +374,4 @@
         m_hButtonGrabWindow = 0;
 
-# endif /* QT_VERSION >= 0x050000 */
 #else
 
@@ -613,13 +490,19 @@
 #endif /* VBOX_WS_WIN */
 
-#if QT_VERSION < 0x050000
-# if defined(VBOX_WS_MAC)
-
-bool UIKeyboardHandler::macEventFilter(const void *pvCocoaEvent, EventRef event, ulong uScreenId)
-{
+bool UIKeyboardHandler::nativeEventFilter(void *pMessage, ulong uScreenId)
+{
+    /* Make sure view with passed index exists: */
+    if (!m_views.contains(uScreenId))
+        return false;
+
     /* Check if some system event should be filtered out.
      * Returning @c true means filtering-out,
      * Returning @c false means passing event to Qt. */
     bool fResult = false; /* Pass to Qt by default. */
+
+# if defined(VBOX_WS_MAC)
+
+    /* Acquire carbon event reference from the cocoa one: */
+    EventRef event = static_cast<EventRef>(darwinCocoaToCarbonEvent(pMessage));
 
     /* Depending on event kind: */
@@ -691,5 +574,5 @@
 
             /* Adjust new modifier mask to distinguish left/right modifiers: */
-            uNewMask = ::DarwinAdjustModifierMask(uNewMask, pvCocoaEvent);
+            uNewMask = ::DarwinAdjustModifierMask(uNewMask, pMessage);
 
             /* Determine what is really changed: */
@@ -753,20 +636,12 @@
     }
 
-    /* Return result: */
-    return fResult;
-}
-
 # elif defined(VBOX_WS_WIN)
 
-bool UIKeyboardHandler::winEventFilter(MSG *pMsg, ulong uScreenId)
-{
     /* Ignore this event if m_fSkipKeyboardEvents is set by winSkipKeyboardEvents(). */
     if (m_fSkipKeyboardEvents)
         return false;
 
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
+    /* Cast to MSG event: */
+    MSG *pMsg = static_cast<MSG*>(pMessage);
 
     /* Depending on message type: */
@@ -779,4 +654,14 @@
         case WM_SYSKEYUP:
         {
+            // WORKAROUND:
+            // Can't do COM inter-process calls from a SendMessage handler,
+            // see http://support.microsoft.com/kb/131056.
+            if (vboxGlobal().isSeparateProcess() && InSendMessage())
+            {
+                PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
+                fResult = true;
+                break;
+            }
+
             /* Check for our own special flag to ignore this event.
              * That flag could only be set later in this function
@@ -918,458 +803,4 @@
     }
 
-    /* Return result: */
-    return fResult;
-}
-
-# elif defined(VBOX_WS_X11)
-
-static Bool UIKeyboardHandlerCompEvent(Display*, XEvent *pEvent, XPointer pvArg)
-{
-    XEvent *pKeyEvent = (XEvent*)pvArg;
-    if ((pEvent->type == XKeyPress) && (pEvent->xkey.keycode == pKeyEvent->xkey.keycode))
-        return True;
-    else
-        return False;
-}
-
-bool UIKeyboardHandler::x11EventFilter(XEvent *pEvent, ulong uScreenId)
-{
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
-
-    /* Depending on event type: */
-    switch (pEvent->type)
-    {
-        /* We have to handle XFocusOut right here as this event is not passed to UIMachineView::event().
-         * Handling this event is important for releasing the keyboard before the screen saver gets active.
-         * See public ticket #3894: Apparently this makes problems with newer versions of Qt
-         * and this hack is probably not necessary anymore. So disable it for Qt >= 4.5.0. */
-        case XFocusOut:
-        case XFocusIn:
-        {
-            if (isSessionRunning())
-            {
-                if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0))
-                {
-                    if (pEvent->type == XFocusIn)
-                    {
-                        /* Capture keyboard by chosen view number: */
-                        captureKeyboard(uScreenId);
-                        /* Reset the single-time disable capture flag: */
-                        if (isAutoCaptureDisabled())
-                            setAutoCaptureDisabled(false);
-                    }
-                    else
-                    {
-                        /* Release keyboard: */
-                        releaseKeyboard();
-                        /* And all pressed keys including host-one: */
-                        releaseAllPressedKeys(true);
-                    }
-                }
-            }
-            fResult = false;
-            break;
-        }
-        /* Watch for key-events: */
-        case XKeyPress:
-        case XKeyRelease:
-        {
-            /* Translate the keycode to a PC scan code: */
-            unsigned uScan = handleXKeyEvent(pEvent->xkey.display, pEvent->xkey.keycode);
-
-            /* Scan codes 0x00 (no valid translation) and 0x80 (extended flag) are ignored: */
-            if (!(uScan & 0x7F))
-            {
-                fResult = true;
-                break;
-            }
-
-            /* Fix for http://www.virtualbox.org/ticket/1296:
-             * when X11 sends events for repeated keys, it always inserts an XKeyRelease before the XKeyPress. */
-            XEvent returnEvent;
-            if ((pEvent->type == XKeyRelease) && (XCheckIfEvent(pEvent->xkey.display, &returnEvent,
-                UIKeyboardHandlerCompEvent, (XPointer)pEvent) == True))
-            {
-                XPutBackEvent(pEvent->xkey.display, &returnEvent);
-                fResult = true;
-                break;
-            }
-
-            /* Calculate flags: */
-            int iFlags = 0;
-            if (uScan >> 8)
-                iFlags |= KeyExtended;
-            if (pEvent->type == XKeyPress)
-                iFlags |= KeyPressed;
-
-            /* Remove the extended flag: */
-            uScan &= 0x7F;
-
-            /* Special Korean keys must send scan code 0xF1/0xF2
-             * when pressed and nothing when released. */
-            if (uScan == 0x71 || uScan == 0x72)
-            {
-                if (pEvent->type == XKeyRelease)
-                {
-                    fResult = true;
-                    break;
-                }
-                /* Re-create the bizarre scan code: */
-                uScan |= 0x80;
-            }
-
-            /* Translate the keycode to a keysym: */
-            KeySym ks = ::wrapXkbKeycodeToKeysym(pEvent->xkey.display, pEvent->xkey.keycode, 0, 0);
-
-            /* Update special flags: */
-            switch (ks)
-            {
-                case XK_Print:
-                    iFlags |= KeyPrint;
-                    break;
-                case XK_Pause:
-                    if (pEvent->xkey.state & ControlMask) /* Break */
-                    {
-                        ks = XK_Break;
-                        iFlags |= KeyExtended;
-                        uScan = 0x46;
-                    }
-                    else
-                        iFlags |= KeyPause;
-                    break;
-            }
-
-            /* Finally, handle parsed key-event: */
-            fResult = keyEvent(ks, uScan, iFlags, uScreenId);
-
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Return result: */
-    return fResult;
-}
-
-# endif /* VBOX_WS_X11 */
-#else /* QT_VERSION >= 0x050000 */
-
-bool UIKeyboardHandler::nativeEventFilter(void *pMessage, ulong uScreenId)
-{
-    /* Make sure view with passed index exists: */
-    if (!m_views.contains(uScreenId))
-        return false;
-
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
-
-# if defined(VBOX_WS_MAC)
-
-    /* Acquire carbon event reference from the cocoa one: */
-    EventRef event = static_cast<EventRef>(darwinCocoaToCarbonEvent(pMessage));
-
-    /* Depending on event kind: */
-    const UInt32 uEventKind = ::GetEventKind(event);
-    switch (uEventKind)
-    {
-        /* Watch for simple key-events: */
-        case kEventRawKeyDown:
-        case kEventRawKeyRepeat:
-        case kEventRawKeyUp:
-        {
-            /* Acquire keycode: */
-            UInt32 uKeyCode = ~0U;
-            ::GetEventParameter(event, kEventParamKeyCode, typeUInt32,
-                                NULL, sizeof(uKeyCode), NULL, &uKeyCode);
-
-            /* The usb keyboard driver translates these codes to different virtual
-             * keycodes depending of the keyboard type. There are ANSI, ISO, JIS
-             * and unknown. For European keyboards (ISO) the key 0xa and 0x32 have
-             * to be switched. Here we are doing this at runtime, cause the user
-             * can have more than one keyboard (of different type), where he may
-             * switch at will all the time. Default is the ANSI standard as defined
-             * in g_aDarwinToSet1. Please note that the "~" on some English ISO
-             * keyboards will be wrongly swapped. This can maybe fixed by
-             * using a Apple keyboard layout in the guest. */
-            if (   (uKeyCode == 0xa || uKeyCode == 0x32)
-                && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO)
-                uKeyCode = 0x3c - uKeyCode;
-
-            /* Translate keycode to set 1 scan code: */
-            unsigned uScanCode = ::DarwinKeycodeToSet1Scancode(uKeyCode);
-
-            /* If scan code is valid: */
-            if (uScanCode)
-            {
-                /* Calculate flags: */
-                int iFlags = 0;
-                if (uEventKind != kEventRawKeyUp)
-                    iFlags |= KeyPressed;
-                if (uScanCode & VBOXKEY_EXTENDED)
-                    iFlags |= KeyExtended;
-                /** @todo KeyPause, KeyPrint. */
-                uScanCode &= VBOXKEY_SCANCODE_MASK;
-
-                /* Get the unicode string (if present): */
-                AssertCompileSize(wchar_t, 2);
-                AssertCompileSize(UniChar, 2);
-                ByteCount cbWritten = 0;
-                wchar_t ucs[8];
-                if (::GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText,
-                                        NULL, sizeof(ucs), &cbWritten, &ucs[0]) != 0)
-                    cbWritten = 0;
-                ucs[cbWritten / sizeof(wchar_t)] = 0; /* The api doesn't terminate it. */
-
-                /* Finally, handle parsed key-event: */
-                fResult = keyEvent(uKeyCode, uScanCode, iFlags, uScreenId, ucs[0] ? ucs : NULL);
-            }
-
-            break;
-        }
-        /* Watch for modifier key-events: */
-        case kEventRawKeyModifiersChanged:
-        {
-            /* Acquire new modifier mask, it may contain
-             * multiple modifier changes, kind of annoying: */
-            UInt32 uNewMask = 0;
-            ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32,
-                                NULL, sizeof(uNewMask), NULL, &uNewMask);
-
-            /* Adjust new modifier mask to distinguish left/right modifiers: */
-            uNewMask = ::DarwinAdjustModifierMask(uNewMask, pMessage);
-
-            /* Determine what is really changed: */
-            const UInt32 changed = uNewMask ^ m_uDarwinKeyModifiers;
-            if (changed)
-            {
-                for (UInt32 bit = 0; bit < 32; ++bit)
-                {
-                    /* Skip unchanged bits: */
-                    if (!(changed & (1 << bit)))
-                        continue;
-                    /* Acquire set 1 scan code from new mask: */
-                    unsigned uScanCode = ::DarwinModifierMaskToSet1Scancode(1 << bit);
-                    /* Skip invalid scan codes: */
-                    if (!uScanCode)
-                        continue;
-                    /* Acquire darwin keycode from new mask: */
-                    unsigned uKeyCode = ::DarwinModifierMaskToDarwinKeycode(1 << bit);
-                    /* Assert invalid keycodes: */
-                    Assert(uKeyCode);
-
-                    /* For non-lockable modifier: */
-                    if (!(uScanCode & VBOXKEY_LOCK))
-                    {
-                        /* Calculate flags: */
-                        unsigned uFlags = (uNewMask & (1 << bit)) ? KeyPressed : 0;
-                        if (uScanCode & VBOXKEY_EXTENDED)
-                            uFlags |= KeyExtended;
-                        uScanCode &= VBOXKEY_SCANCODE_MASK;
-
-                        /* Finally, handle parsed key-event: */
-                        keyEvent(uKeyCode, uScanCode & 0xff, uFlags, uScreenId);
-                    }
-                    /* For lockable modifier: */
-                    else
-                    {
-                        /* Calculate flags: */
-                        unsigned uFlags = 0;
-                        if (uScanCode & VBOXKEY_EXTENDED)
-                            uFlags |= KeyExtended;
-                        uScanCode &= VBOXKEY_SCANCODE_MASK;
-
-                        /* Finally, handle parsed press/release pair: */
-                        keyEvent(uKeyCode, uScanCode, uFlags | KeyPressed, uScreenId);
-                        keyEvent(uKeyCode, uScanCode, uFlags, uScreenId);
-                    }
-                }
-            }
-
-            /* Remember new modifier mask: */
-            m_uDarwinKeyModifiers = uNewMask;
-
-            /* Always return true here because we'll otherwise getting a Qt event
-             * we don't want and that will only cause the Pause warning to pop up: */
-            fResult = true;
-
-            break;
-        }
-        default:
-            break;
-    }
-
-# elif defined(VBOX_WS_WIN)
-
-    /* Ignore this event if m_fSkipKeyboardEvents is set by winSkipKeyboardEvents(). */
-    if (m_fSkipKeyboardEvents)
-        return false;
-
-    /* Cast to MSG event: */
-    MSG *pMsg = static_cast<MSG*>(pMessage);
-
-    /* Depending on message type: */
-    switch (pMsg->message)
-    {
-        /* Watch for key-events: */
-        case WM_KEYDOWN:
-        case WM_KEYUP:
-        case WM_SYSKEYDOWN:
-        case WM_SYSKEYUP:
-        {
-            // WORKAROUND:
-            // Can't do COM inter-process calls from a SendMessage handler,
-            // see http://support.microsoft.com/kb/131056.
-            if (vboxGlobal().isSeparateProcess() && InSendMessage())
-            {
-                PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
-                fResult = true;
-                break;
-            }
-
-            /* Check for our own special flag to ignore this event.
-             * That flag could only be set later in this function
-             * so having it here means this event came here
-             * for the second time already. */
-            if (pMsg->lParam & (0x1 << 25))
-            {
-                /* Remove that flag as well: */
-                pMsg->lParam &= ~(0x1 << 25);
-                fResult = false;
-                break;
-            }
-
-            /* Scan codes 0x80 and 0x00 should be filtered out: */
-            unsigned uScan = (pMsg->lParam >> 16) & 0x7F;
-            if (!uScan)
-            {
-                fResult = true;
-                break;
-            }
-
-            /* Get the virtual key: */
-            int iVKey = pMsg->wParam;
-
-            /* Calculate flags: */
-            int iFlags = 0;
-            if (pMsg->lParam & 0x1000000)
-                iFlags |= KeyExtended;
-            if (!(pMsg->lParam & 0x80000000))
-                iFlags |= KeyPressed;
-
-            /* Make sure AltGr monitor exists: */
-            AssertPtrReturn(m_pAltGrMonitor, false);
-            {
-                /* Filter event out if we are sure that this is a fake left control event: */
-                if (m_pAltGrMonitor->isCurrentEventDefinitelyFake(uScan, iFlags & KeyPressed, iFlags & KeyExtended))
-                {
-                    fResult = true;
-                    break;
-                }
-                /* Update AltGR monitor state from key-event: */
-                m_pAltGrMonitor->updateStateFromKeyEvent(uScan, iFlags & KeyPressed, iFlags & KeyExtended);
-                /* And release left Ctrl key early (if required): */
-                if (m_pAltGrMonitor->isLeftControlReleaseNeeded())
-                    keyboard().PutScancode(0x1D | 0x80);
-            }
-
-            /* Check for special Korean keys. Based on the keyboard layout selected
-             * on the host, the scan code in lParam might be 0x71/0x72 or 0xF1/0xF2.
-             * In either case, we must deliver 0xF1/0xF2 scan code to the guest when
-             * the key is pressed and nothing when it's released. */
-            if (uScan == 0x71 || uScan == 0x72)
-            {
-                uScan |= 0x80;
-                iFlags = KeyPressed;   /* Because a release would be ignored. */
-                iVKey = VK_PROCESSKEY; /* In case it was 0xFF. */
-            }
-
-            /* When one of the SHIFT keys is held and one of the cursor movement
-             * keys is pressed, Windows duplicates SHIFT press/release messages,
-             * but with the virtual keycode set to 0xFF. These virtual keys are also
-             * sent in some other situations (Pause, PrtScn, etc.). Filter out such messages. */
-            if (iVKey == 0xFF)
-            {
-                fResult = true;
-                break;
-            }
-
-            /* Handle special virtual keys: */
-            switch (iVKey)
-            {
-                case VK_SHIFT:
-                case VK_CONTROL:
-                case VK_MENU:
-                {
-                    /* Overcome Win32 modifier key generalization: */
-                    int iKeyscan = uScan;
-                    if (iFlags & KeyExtended)
-                        iKeyscan |= 0xE000;
-                    switch (iKeyscan)
-                    {
-                        case 0x002A: iVKey = VK_LSHIFT;   break;
-                        case 0x0036: iVKey = VK_RSHIFT;   break;
-                        case 0x001D: iVKey = VK_LCONTROL; break;
-                        case 0xE01D: iVKey = VK_RCONTROL; break;
-                        case 0x0038: iVKey = VK_LMENU;    break;
-                        case 0xE038: iVKey = VK_RMENU;    break;
-                    }
-                    break;
-                }
-                case VK_NUMLOCK:
-                    /* Win32 sets the extended bit for the NumLock key. Reset it: */
-                    iFlags &= ~KeyExtended;
-                    break;
-                case VK_SNAPSHOT:
-                    iFlags |= KeyPrint;
-                    break;
-                case VK_PAUSE:
-                    iFlags |= KeyPause;
-                    break;
-            }
-
-            /* Finally, handle parsed key-event: */
-            fResult = keyEvent(iVKey, uScan, iFlags, uScreenId);
-
-            /* Always let Windows see key releases to prevent stuck keys.
-             * Hopefully this won't cause any other issues. */
-            if (pMsg->message == WM_KEYUP || pMsg->message == WM_SYSKEYUP)
-            {
-                fResult = false;
-                break;
-            }
-
-            /* Above keyEvent() returned that it didn't processed the event, but since the
-             * keyboard is captured, we don't want to pass it to Windows. We just want
-             * to let Qt process the message (to handle non-alphanumeric <HOST>+key
-             * shortcuts for example). So send it directly to the window with the
-             * special flag in the reserved area of lParam (to avoid recursion). */
-            if (!fResult && m_fIsKeyboardCaptured)
-            {
-                ::SendMessage(pMsg->hwnd, pMsg->message,
-                              pMsg->wParam, pMsg->lParam | (0x1 << 25));
-                fResult = true;
-                break;
-            }
-
-            /* These special keys have to be handled by Windows as well to update the
-             * internal modifier state and to enable/disable the keyboard LED: */
-            if (iVKey == VK_NUMLOCK || iVKey == VK_CAPITAL || iVKey == VK_LSHIFT || iVKey == VK_RSHIFT)
-            {
-                fResult = false;
-                break;
-            }
-
-            break;
-        }
-        default:
-            break;
-    }
-
 # elif defined(VBOX_WS_X11)
 
@@ -1470,6 +901,4 @@
     return fResult;
 }
-
-#endif /* QT_VERSION >= 0x050000 */
 
 /* Machine state-change handler: */
@@ -1527,5 +956,4 @@
 }
 
-#if QT_VERSION >= 0x050000
 void UIKeyboardHandler::sltFinaliseCaptureKeyboard()
 {
@@ -1537,5 +965,4 @@
     }
 }
-#endif
 
 /* Keyboard-handler constructor: */
@@ -1559,7 +986,5 @@
     , m_pAltGrMonitor(0)
 #elif defined(VBOX_WS_X11)
-# if QT_VERSION >= 0x050000
     , m_hButtonGrabWindow(0)
-# endif
 #endif /* VBOX_WS_X11 */
     , m_cMonitors(1)
@@ -1866,10 +1291,6 @@
 
     /* Pass event to machine-view's event handler: */
-#if QT_VERSION < 0x050000
-    return m_views[m_iKeyboardHookViewIndex]->macEvent(pvCocoaEvent, event);
-#else /* QT_VERSION >= 0x050000 */
     Q_UNUSED(event);
     return nativeEventFilter(unconst(pvCocoaEvent), m_iKeyboardHookViewIndex);
-#endif /* QT_VERSION >= 0x050000 */
 }
 
@@ -1931,10 +1352,5 @@
 
     /* Pass event to view's event handler: */
-#if QT_VERSION < 0x050000
-    long dummyResult;
-    return m_views[m_iKeyboardHookViewIndex]->winEvent(&message, &dummyResult);
-#else /* QT_VERSION >= 0x050000 */
     return nativeEventFilter(&message, m_iKeyboardHookViewIndex);
-#endif /* QT_VERSION >= 0x050000 */
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h	(revision 68315)
@@ -45,12 +45,8 @@
 #ifdef VBOX_WS_WIN
 class WinAltGrMonitor;
-#endif /* VBOX_WS_WIN */
+#endif
 #ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-typedef union _XEvent XEvent;
-#else
 #  include <xcb/xcb.h>
-# endif /* QT_VERSION >= 0x050000 */
-#endif /* VBOX_WS_X11 */
+#endif
 
 
@@ -74,11 +70,4 @@
     void prepareListener(ulong uScreenId, UIMachineWindow *pMachineWindow);
     void cleanupListener(ulong uScreenId);
-
-    /* Commands to capture/release keyboard: */
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-    bool checkForX11FocusEvents(unsigned long hWindow);
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 
     /** Captures the keyboard for @a uScreenId. */
@@ -113,19 +102,6 @@
 #endif /* VBOX_WS_WIN */
 
-#if QT_VERSION < 0x050000
-# if defined(VBOX_WS_MAC)
-    /** Qt4: Mac: Performs pre-processing of all the native events. */
-    bool macEventFilter(const void *pvCocoaEvent, EventRef event, ulong uScreenId);
-# elif defined(VBOX_WS_WIN)
-    /** Qt4: Win: Performs pre-processing of all the native events. */
-    bool winEventFilter(MSG *pMsg, ulong uScreenId);
-# elif defined(VBOX_WS_X11)
-    /** Qt4: X11: Performs pre-processing of all the native events. */
-    bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
-# endif /* VBOX_WS_X11 */
-#else
     /** Qt5: Performs pre-processing of all the native events. */
     bool nativeEventFilter(void *pMessage, ulong uScreenId);
-#endif
 
 protected slots:
@@ -134,10 +110,10 @@
     virtual void sltMachineStateChanged();
 
-#if QT_VERSION >= 0x050000
+#if QT_VERSION == 0
+    /** Stupid moc does not warn if it cannot find headers! */
+    void QT_VERSION_NOT_DEFINED
+#else
     /** Finalises keyboard capture. */
     void sltFinaliseCaptureKeyboard();
-#elif QT_VERSION == 0
-    /** Stupid moc does not warn if it cannot find headers! */
-    void QT_VERSION_NOT_DEFINED
 #endif
 
@@ -244,8 +220,6 @@
     static UIKeyboardHandler *m_spKeyboardHandler;
 #elif defined(VBOX_WS_X11)
-# if QT_VERSION >= 0x050000
     /** The root window at the time we grab the mouse buttons. */
     xcb_window_t m_hButtonGrabWindow;
-# endif
 #endif /* VBOX_WS_X11 */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 68315)
@@ -1268,11 +1268,6 @@
     pDockMenu->addMenu(pDockSettingsMenu);
 
-# if QT_VERSION < 0x050000
-    /* Add it to the dock. */
-    ::darwinSetDockIconMenu(pDockMenu);
-# else /* QT_VERSION >= 0x050000 */
     /* Add it to the dock: */
     pDockMenu->setAsDockMenu();
-# endif /* QT_VERSION >= 0x050000 */
 
     /* Now the dock icon preview: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 68315)
@@ -72,7 +72,5 @@
 
 /* Qt includes: */
-#if QT_VERSION >= 0x050000
 # include <QAbstractNativeEventFilter>
-#endif
 
 /* GUI includes: */
@@ -100,22 +98,8 @@
 #ifdef VBOX_WS_MAC
 # include <Carbon/Carbon.h>
-#endif /* VBOX_WS_MAC */
+#endif
 #ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-#  include <X11/XKBlib.h>
-#  ifdef KeyPress
-const int XFocusIn = FocusIn;
-const int XFocusOut = FocusOut;
-const int XKeyPress = KeyPress;
-const int XKeyRelease = KeyRelease;
-#   undef KeyRelease
-#   undef KeyPress
-#   undef FocusOut
-#   undef FocusIn
-#  endif /* KeyPress */
-# else /* QT_VERSION >= 0x050000 */
 #  include <xcb/xcb.h>
-# endif /* QT_VERSION >= 0x050000 */
-#endif /* VBOX_WS_X11 */
+#endif
 
 #ifdef DEBUG_andy
@@ -128,5 +112,4 @@
 
 
-#if QT_VERSION >= 0x050000
 /** QAbstractNativeEventFilter extension
   * allowing to pre-process native platform events. */
@@ -151,5 +134,4 @@
     UIMachineView *m_pParent;
 };
-#endif
 
 
@@ -660,7 +642,5 @@
     , m_fIsDraggingFromGuest(false)
 #endif
-#if QT_VERSION >= 0x050000
     , m_pNativeEventFilter(0)
-#endif
 {
 }
@@ -888,5 +868,4 @@
 void UIMachineView::cleanupNativeFilters()
 {
-#if QT_VERSION >= 0x050000
     /* If native event filter exists: */
     if (m_pNativeEventFilter)
@@ -897,5 +876,4 @@
         m_pNativeEventFilter = 0;
     }
-#endif
 }
 
@@ -1525,9 +1503,5 @@
     {
         /* We have a snapshot for the paused state: */
-#if QT_VERSION >= 0x050000
         QRect rect = pPaintEvent->rect().intersected(viewport()->rect());
-#else /* QT_VERSION < 0x050000 */
-        QRect rect = pPaintEvent->rect().intersect(viewport()->rect());
-#endif /* QT_VERSION < 0x050000 */
         QPainter painter(viewport());
         /* Take the scale-factor into account: */
@@ -1553,5 +1527,4 @@
 }
 
-#if QT_VERSION >= 0x050000
 void UIMachineView::focusInEvent(QFocusEvent *pEvent)
 {
@@ -1582,5 +1555,4 @@
     QAbstractScrollArea::focusOutEvent(pEvent);
 }
-#endif
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
@@ -1763,133 +1735,4 @@
 }
 #endif /* VBOX_WITH_DRAG_AND_DROP */
-
-#if QT_VERSION < 0x050000
-# if defined(VBOX_WS_MAC)
-
-bool UIMachineView::macEvent(const void *pvCocoaEvent, EventRef event)
-{
-    /* Make sure arguments valid: */
-    AssertPtrReturn(pvCocoaEvent, false);
-    AssertReturn(event != NULL, false);
-
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
-    switch (::GetEventClass(event))
-    {
-        /* Watch for keyboard-events: */
-        case kEventClassKeyboard:
-        {
-            switch (::GetEventKind(event))
-            {
-                /* Watch for key-events: */
-                case kEventRawKeyDown:
-                case kEventRawKeyRepeat:
-                case kEventRawKeyUp:
-                case kEventRawKeyModifiersChanged:
-                {
-                    /* Filter using keyboard-filter? */
-                    bool fKeyboardFilteringResult =
-                        machineLogic()->keyboardHandler()->macEventFilter(pvCocoaEvent, event, screenId());
-                    /* Keyboard filter rules the result? */
-                    fResult = fKeyboardFilteringResult;
-                    break;
-                }
-                default:
-                    break;
-            }
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Return result: */
-    return fResult;
-}
-
-# elif defined(VBOX_WS_WIN)
-
-bool UIMachineView::winEvent(MSG *pMsg, long* /* piResult */)
-{
-    /* Make sure arguments valid: */
-    AssertPtrReturn(pMsg, false);
-
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
-    switch (pMsg->message)
-    {
-        /* Watch for key-events: */
-        case WM_KEYDOWN:
-        case WM_KEYUP:
-        case WM_SYSKEYDOWN:
-        case WM_SYSKEYUP:
-        {
-            /* Can't do COM inter-process calls from a SendMessage handler,
-             * see http://support.microsoft.com/kb/131056. */
-            if (vboxGlobal().isSeparateProcess() && InSendMessage())
-            {
-                PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
-                fResult = true;
-                break;
-            }
-            /* Filter using keyboard filter? */
-            bool fKeyboardFilteringResult =
-                machineLogic()->keyboardHandler()->winEventFilter(pMsg, screenId());
-            /* Keyboard filter rules the result? */
-            fResult = fKeyboardFilteringResult;
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Return result: */
-    return fResult;
-}
-
-# elif defined(VBOX_WS_X11)
-
-bool UIMachineView::x11Event(XEvent *pEvent)
-{
-    /* Make sure arguments valid: */
-    AssertPtrReturn(pEvent, false);
-
-    /* Check if some system event should be filtered out.
-     * Returning @c true means filtering-out,
-     * Returning @c false means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default. */
-    switch (pEvent->type)
-    {
-        /* Watch for focus-events: */
-        case XFocusIn:
-        case XFocusOut:
-        /* Watch for key-events: */
-        case XKeyPress:
-        case XKeyRelease:
-        {
-            /* Filter using keyboard-filter? */
-            bool fKeyboardFilteringResult =
-                machineLogic()->keyboardHandler()->x11EventFilter(pEvent, screenId());
-            /* Filter using mouse-filter? */
-            bool fMouseFilteringResult =
-                machineLogic()->mouseHandler()->x11EventFilter(pEvent, screenId());
-            /* If at least one of filters wants to filter event out then the result is true. */
-            fResult = fKeyboardFilteringResult || fMouseFilteringResult;
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Return result: */
-    return fResult;
-}
-
-# endif /* VBOX_WS_X11 */
-#else /* QT_VERSION >= 0x050000 */
 
 bool UIMachineView::nativeEventPreprocessor(const QByteArray &eventType, void *pMessage)
@@ -2024,6 +1867,4 @@
 }
 
-#endif /* QT_VERSION >= 0x050000 */
-
 QSize UIMachineView::scaledForward(QSize size) const
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 68315)
@@ -36,7 +36,5 @@
 #include "VBox/com/ptr.h"
 #ifdef VBOX_WS_MAC
-# if QT_VERSION >= 0x050000
 #  include <ApplicationServices/ApplicationServices.h>
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC */
 
@@ -52,4 +50,5 @@
 class UIMachineWindow;
 class UIFrameBuffer;
+class UINativeEventFilter;
 class CConsole;
 class CDisplay;
@@ -57,14 +56,6 @@
 class CMachine;
 class CSession;
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-typedef union _XEvent XEvent;
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 #ifdef VBOX_WITH_DRAG_AND_DROP
- class CDnDTarget;
-#endif /* VBOX_WITH_DRAG_AND_DROP */
-#if QT_VERSION >= 0x050000
-class UINativeEventFilter;
+class CDnDTarget;
 #endif
 
@@ -271,10 +262,8 @@
     void paintEvent(QPaintEvent *pEvent);
 
-#if QT_VERSION >= 0x050000
     /** Handles focus-in @a pEvent. */
     void focusInEvent(QFocusEvent *pEvent);
     /** Handles focus-out @a pEvent. */
     void focusOutEvent(QFocusEvent *pEvent);
-#endif
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
@@ -344,28 +333,6 @@
 #endif /* VBOX_WITH_DRAG_AND_DROP */
 
-#if QT_VERSION < 0x050000
-# if defined(VBOX_WS_MAC)
-    /** Qt4: Mac: Performs pre-processing of all the native events.
-      * @note     Take into account this function is _not_ called by
-      *           the Qt itself because it has another signature,
-      *           only by the keyboard-hook of the keyboard-handler. */
-    virtual bool macEvent(const void *pvCocoaEvent, EventRef event);
-# elif defined(VBOX_WS_WIN)
-    /** Qt4: Win: Performs pre-processing of all the native events.
-      * @note     Take into account this function is called by
-      *           the Qt as well opposing to other host (Mac)
-      *           because it has required signature. */
-    virtual bool winEvent(MSG *pMsg, long *piResult);
-# elif defined(VBOX_WS_X11)
-    /** Qt4: X11: Performs pre-processing of all the native events.
-      * @note     Take into account this function is called by
-      *           the Qt as well opposing to other host (Mac)
-      *           because it has required signature. */
-    virtual bool x11Event(XEvent *pEvent);
-# endif /* VBOX_WS_X11 */
-#else /* QT_VERSION >= 0x050000 */
     /** Qt5: Performs pre-processing of all the native events. */
     virtual bool nativeEventPreprocessor(const QByteArray &eventType, void *pMessage);
-#endif /* QT_VERSION >= 0x050000 */
 
     /** Scales passed size forward. */
@@ -424,5 +391,4 @@
 #endif
 
-#if QT_VERSION >= 0x050000
     /** Holds the native event filter instance. */
     UINativeEventFilter *m_pNativeEventFilter;
@@ -430,5 +396,4 @@
       * events directly to nativeEventPreprocessor(). */
     friend class UINativeEventFilter;
-#endif
 
     /* Friend classes: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 68315)
@@ -55,11 +55,4 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* External includes: */
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-#  include <X11/Xlib.h>
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
-
 
 /* static */
@@ -252,29 +245,4 @@
     updateAppearanceOf(UIVisualElement_WindowTitle);
 }
-
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-bool UIMachineWindow::x11Event(XEvent *pEvent)
-{
-    /// @todo Is that really needed?
-    /* Qt bug: when the machine-view grabs the keyboard,
-     * FocusIn, FocusOut, WindowActivate and WindowDeactivate Qt events are
-     * not properly sent on top level window deactivation.
-     * The fix is to substiute the mode in FocusOut X11 event structure
-     * to NotifyNormal to cause Qt to process it as desired. */
-    if (pEvent->type == FocusOut)
-    {
-        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
-            (pEvent->xfocus.detail == NotifyAncestor ||
-             pEvent->xfocus.detail == NotifyInferior ||
-             pEvent->xfocus.detail == NotifyNonlinear))
-        {
-             pEvent->xfocus.mode = NotifyNormal;
-        }
-    }
-    return false;
-}
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 
 void UIMachineWindow::showEvent(QShowEvent *pShowEvent)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h	(revision 68315)
@@ -42,9 +42,4 @@
 class UIMachineView;
 class CSession;
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-typedef union _XEvent XEvent;
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 
 
@@ -129,12 +124,4 @@
     /* Translate stuff: */
     void retranslateUi();
-
-    /* Event handlers: */
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-    /** X11: Qt4: Handles all native events. */
-    bool x11Event(XEvent *pEvent);
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 
     /** Show event handler. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp	(revision 68315)
@@ -23,5 +23,5 @@
 # include <QMouseEvent>
 # include <QTimer>
-# if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+# ifdef VBOX_WS_X11
 #  include <QX11Info>
 # endif
@@ -59,5 +59,5 @@
 
 /* GUI includes: */
-#if defined(VBOX_WS_MAC) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_MAC
 # include "CocoaEventHelper.h"
 #endif
@@ -68,13 +68,5 @@
 /* External includes: */
 #ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-#  include <X11/Xlib.h>
-#  ifdef FocusOut
-const int XFocusOut = FocusOut;
-#   undef FocusOut
-#  endif /* FocusOut */
-# else
-#  include <xcb/xcb.h>
-# endif
+# include <xcb/xcb.h>
 #endif
 
@@ -273,38 +265,4 @@
            (uisession()->isMouseIntegrated() ? 0 : UIMouseStateType_MouseAbsoluteDisabled);
 }
-
-#if QT_VERSION < 0x050000
-# ifdef VBOX_WS_X11
-
-bool UIMouseHandler::x11EventFilter(XEvent *pEvent, ulong /* uScreenId */)
-{
-    /* Check if some system event should be filtered-out.
-     * Returning 'true' means filtering-out,
-     * Returning 'false' means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default: */
-    switch (pEvent->type)
-    {
-        /* We have to handle XFocusOut right here as this event is not passed to UIMachineView::event().
-         * Handling this event is important for releasing the keyboard before the screen saver gets active.
-         * See public ticket #3894: Apparently this makes problems with newer versions of Qt
-         * and this hack is probably not necessary anymore. So disable it for Qt >= 4.5.0. */
-        case XFocusOut:
-        {
-            if (uisession()->isRunning())
-            {
-                if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0))
-                    releaseMouse();
-            }
-            fResult = false;
-        }
-        default:
-            break;
-    }
-    /* Return result: */
-    return fResult;
-}
-
-# endif /* VBOX_WS_X11 */
-#else /* QT_VERSION >= 0x050000 */
 
 bool UIMouseHandler::nativeEventFilter(void *pMessage, ulong uScreenId)
@@ -413,6 +371,4 @@
     return fResult;
 }
-
-#endif /* QT_VERSION >= 0x050000 */
 
 /* Machine state-change handler: */
@@ -774,5 +730,5 @@
                 {
                     QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
                     /* When the keyboard is captured, we also capture mouse button
                      * events, and release the keyboard and re-capture it delayed
@@ -783,5 +739,5 @@
                     if (pEvent->type() == QEvent::MouseButtonPress)
                         machineLogic()->keyboardHandler()->finaliseCaptureKeyboard();
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
                     m_iLastMouseWheelDelta = 0;
                     if (mouseEvent(pMouseEvent->type(), uScreenId,
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h	(revision 68315)
@@ -38,9 +38,4 @@
 class CDisplay;
 class CMouse;
-#ifdef VBOX_WS_X11
-# if QT_VERSION < 0x050000
-typedef union _XEvent XEvent;
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_X11 */
 
 
@@ -75,13 +70,6 @@
     int state() const;
 
-#if QT_VERSION < 0x050000
-# ifdef VBOX_WS_X11
-    /** Qt4: X11: Performs pre-processing of all the native events. */
-    bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
-# endif
-#else
     /** Qt5: Performs pre-processing of all the native events. */
     bool nativeEventFilter(void *pMessage, ulong uScreenId);
-#endif
 
 protected slots:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 68315)
@@ -75,7 +75,5 @@
 /* Qt includes: */
 #ifdef VBOX_WS_WIN
-# if QT_VERSION >= 0x050000
-#  include <QtWin>
-# endif /* QT_VERSION >= 0x050000 */
+# include <QtWin>
 #endif /* VBOX_WS_WIN */
 
@@ -1541,5 +1539,5 @@
 }
 
-#if defined(VBOX_WS_WIN) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_WIN
 static bool isPointer1bpp(const uint8_t *pu8XorMask,
                           uint uWidth,
@@ -1565,5 +1563,5 @@
     return true;
 }
-#endif
+#endif /* VBOX_WS_WIN */
 
 void UISession::setPointerShape(const uchar *pShapeData, bool fHasAlpha,
@@ -1580,129 +1578,4 @@
 #if defined (VBOX_WS_WIN)
 
-# if QT_VERSION < 0x050000
-    BITMAPV5HEADER bi;
-    HBITMAP hBitmap;
-    void *lpBits;
-
-    ::ZeroMemory(&bi, sizeof (BITMAPV5HEADER));
-    bi.bV5Size = sizeof(BITMAPV5HEADER);
-    bi.bV5Width = uWidth;
-    bi.bV5Height = - (LONG)uHeight;
-    bi.bV5Planes = 1;
-    bi.bV5BitCount = 32;
-    bi.bV5Compression = BI_BITFIELDS;
-    bi.bV5RedMask   = 0x00FF0000;
-    bi.bV5GreenMask = 0x0000FF00;
-    bi.bV5BlueMask  = 0x000000FF;
-    if (fHasAlpha)
-        bi.bV5AlphaMask = 0xFF000000;
-    else
-        bi.bV5AlphaMask = 0;
-
-    HDC hdc = GetDC(NULL);
-
-    /* Create the DIB section with an alpha channel: */
-    hBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&lpBits, NULL, (DWORD) 0);
-
-    ReleaseDC(NULL, hdc);
-
-    HBITMAP hMonoBitmap = NULL;
-    if (fHasAlpha)
-    {
-        /* Create an empty mask bitmap: */
-        hMonoBitmap = CreateBitmap(uWidth, uHeight, 1, 1, NULL);
-    }
-    else
-    {
-        /* Word aligned AND mask. Will be allocated and created if necessary. */
-        uint8_t *pu8AndMaskWordAligned = NULL;
-
-        /* Width in bytes of the original AND mask scan line. */
-        uint32_t cbAndMaskScan = (uWidth + 7) / 8;
-
-        if (cbAndMaskScan & 1)
-        {
-            /* Original AND mask is not word aligned. */
-
-            /* Allocate memory for aligned AND mask. */
-            pu8AndMaskWordAligned = (uint8_t *)RTMemTmpAllocZ((cbAndMaskScan + 1) * uHeight);
-
-            Assert(pu8AndMaskWordAligned);
-
-            if (pu8AndMaskWordAligned)
-            {
-                /* According to MSDN the padding bits must be 0.
-                 * Compute the bit mask to set padding bits to 0 in the last byte of original AND mask. */
-                uint32_t u32PaddingBits = cbAndMaskScan * 8  - uWidth;
-                Assert(u32PaddingBits < 8);
-                uint8_t u8LastBytesPaddingMask = (uint8_t)(0xFF << u32PaddingBits);
-
-                Log(("u8LastBytesPaddingMask = %02X, aligned w = %d, width = %d, cbAndMaskScan = %d\n",
-                      u8LastBytesPaddingMask, (cbAndMaskScan + 1) * 8, uWidth, cbAndMaskScan));
-
-                uint8_t *src = (uint8_t *)srcAndMaskPtr;
-                uint8_t *dst = pu8AndMaskWordAligned;
-
-                unsigned i;
-                for (i = 0; i < uHeight; i++)
-                {
-                    memcpy(dst, src, cbAndMaskScan);
-
-                    dst[cbAndMaskScan - 1] &= u8LastBytesPaddingMask;
-
-                    src += cbAndMaskScan;
-                    dst += cbAndMaskScan + 1;
-                }
-            }
-        }
-
-        /* Create the AND mask bitmap: */
-        hMonoBitmap = ::CreateBitmap(uWidth, uHeight, 1, 1,
-                                     pu8AndMaskWordAligned? pu8AndMaskWordAligned: srcAndMaskPtr);
-
-        if (pu8AndMaskWordAligned)
-        {
-            RTMemTmpFree(pu8AndMaskWordAligned);
-        }
-    }
-
-    Assert(hBitmap);
-    Assert(hMonoBitmap);
-    if (hBitmap && hMonoBitmap)
-    {
-        DWORD *dstShapePtr = (DWORD *) lpBits;
-
-        for (uint y = 0; y < uHeight; y ++)
-        {
-            memcpy(dstShapePtr, srcShapePtr, srcShapePtrScan);
-            srcShapePtr += srcShapePtrScan;
-            dstShapePtr += uWidth;
-        }
-
-        ICONINFO ii;
-        ii.fIcon = FALSE;
-        ii.xHotspot = uXHot;
-        ii.yHotspot = uYHot;
-        ii.hbmMask = hMonoBitmap;
-        ii.hbmColor = hBitmap;
-
-        HCURSOR hAlphaCursor = CreateIconIndirect(&ii);
-        Assert(hAlphaCursor);
-        if (hAlphaCursor)
-        {
-            /* Set the new cursor: */
-            m_cursor = QCursor(hAlphaCursor);
-            if (m_alphaCursor)
-                DestroyIcon(m_alphaCursor);
-            m_alphaCursor = hAlphaCursor;
-            m_fIsValidPointerShapePresent = true;
-        }
-    }
-
-    if (hMonoBitmap)
-        DeleteObject(hMonoBitmap);
-    if (hBitmap)
-        DeleteObject(hBitmap);
-# else /* QT_VERSION >= 0x050000 */
     /* Create a ARGB image out of the shape data: */
 
@@ -1849,5 +1722,4 @@
     m_fIsValidPointerShapePresent = true;
     NOREF(srcShapePtrScan);
-# endif /* QT_VERSION >= 0x050000 */
 
 #elif defined(VBOX_WS_X11) || defined(VBOX_WS_MAC)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp	(revision 68315)
@@ -87,7 +87,4 @@
     roleNames[Qt::UserRole + 1] = "";
     roleNames[Qt::UserRole + 2] = "";
-    # if QT_VERSION < 0x050000
-    setRoleNames(roleNames);
-    # endif /* QT_VERSION < 0x050000 */
 
     /* Register meta-type: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 68315)
@@ -254,5 +254,5 @@
 void UIMachineLogicNormal::sltHostScreenAvailableAreaChange()
 {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
     /* Prevent handling if fake screen detected: */
     if (gpDesktop->isFakeScreenDetected())
@@ -262,5 +262,5 @@
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         pMachineWindow->restoreCachedGeometry();
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
     /* Call to base-class: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp	(revision 68315)
@@ -468,9 +468,9 @@
         case QEvent::Resize:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
@@ -488,9 +488,9 @@
         case QEvent::Move:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             if (!isMaximizedChecked())
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp	(revision 68315)
@@ -78,5 +78,5 @@
 void UIMachineLogicScale::sltHostScreenAvailableAreaChange()
 {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
     /* Prevent handling if fake screen detected: */
     if (gpDesktop->isFakeScreenDetected())
@@ -86,5 +86,5 @@
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         pMachineWindow->restoreCachedGeometry();
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
     /* Call to base-class: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp	(revision 68315)
@@ -217,9 +217,9 @@
         case QEvent::Resize:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
@@ -236,9 +236,9 @@
         case QEvent::Move:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             if (!isMaximizedChecked())
@@ -258,53 +258,4 @@
 }
 
-#ifdef VBOX_WS_WIN
-# if QT_VERSION < 0x050000
-bool UIMachineWindowScale::winEvent(MSG *pMessage, long *pResult)
-{
-    /* Try to keep aspect ratio during window resize if:
-     * 1. machine view exists and 2. event-type is WM_SIZING and 3. shift key is NOT pressed: */
-    if (machineView() && pMessage->message == WM_SIZING && !(QApplication::keyboardModifiers() & Qt::ShiftModifier))
-    {
-        double dAspectRatio = machineView()->aspectRatio();
-        if (dAspectRatio)
-        {
-            RECT *pRect = reinterpret_cast<RECT*>(pMessage->lParam);
-            switch (pMessage->wParam)
-            {
-                case WMSZ_LEFT:
-                case WMSZ_RIGHT:
-                {
-                    pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio;
-                    break;
-                }
-                case WMSZ_TOP:
-                case WMSZ_BOTTOM:
-                {
-                    pRect->right = pRect->left + (double)(pRect->bottom - pRect->top) * dAspectRatio;
-                    break;
-                }
-                case WMSZ_BOTTOMLEFT:
-                case WMSZ_BOTTOMRIGHT:
-                {
-                    pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio;
-                    break;
-                }
-                case WMSZ_TOPLEFT:
-                case WMSZ_TOPRIGHT:
-                {
-                    pRect->top = pRect->bottom - (double)(pRect->right - pRect->left) / dAspectRatio;
-                    break;
-                }
-                default:
-                    break;
-            }
-        }
-    }
-    /* Call to base-class: */
-    return UIMachineWindow::winEvent(pMessage, pResult);
-}
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_WIN */
-
 bool UIMachineWindowScale::isMaximizedChecked()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h	(revision 68315)
@@ -63,10 +63,4 @@
     /** Common @a pEvent handler. */
     bool event(QEvent *pEvent);
-#ifdef VBOX_WS_WIN
-# if QT_VERSION < 0x050000
-    /** Qt4: Win: Handles all native messages. */
-    bool winEvent(MSG *pMessage, long *pResult);
-# endif /* QT_VERSION < 0x050000 */
-#endif /* VBOX_WS_WIN */
 
     /** Returns whether this window is maximized. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp	(revision 68315)
@@ -167,5 +167,5 @@
 }
 
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
 void UISelectorWindow::sltHandleHostScreenAvailableAreaChange()
 {
@@ -178,5 +178,5 @@
     move(m_geometry.topLeft());
 }
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
 void UISelectorWindow::sltShowSelectorWindowContextMenu(const QPoint &position)
@@ -1053,9 +1053,5 @@
         const CMachine &machine = pItem->machine();
         UIDesktopServices::createMachineShortcut(machine.GetSettingsFilePath(),
-#if QT_VERSION >= 0x050000
                                                  QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
-#else /* QT_VERSION < 0x050000 */
-                                                 QDesktopServices::storageLocation(QDesktopServices::DesktopLocation),
-#endif /* QT_VERSION < 0x050000 */
                                                  machine.GetName(), machine.GetId());
     }
@@ -1180,6 +1176,10 @@
     sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */);
 
-#if defined(VBOX_WS_MAC) && QT_VERSION < 0x050000
-    /* Avoid bug in Qt Cocoa which results in showing a "more arrow" on size-hint changes: */
+#ifdef VBOX_WS_MAC
+    // WORKAROUND:
+    // There is a bug in Qt Cocoa which result in showing a "more arrow" when
+    // the necessary size of the toolbar is increased. Also for some languages
+    // the with doesn't match if the text increase. So manually adjust the size
+    // after changing the text.
     m_pToolBar->updateLayout();
 #endif
@@ -1194,9 +1194,9 @@
         case QEvent::Resize:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
@@ -1209,9 +1209,9 @@
         case QEvent::Move:
         {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
             /* Prevent handling if fake screen detected: */
             if (gpDesktop->isFakeScreenDetected())
                 break;
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
             if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
@@ -1969,8 +1969,8 @@
 void UISelectorWindow::prepareConnections()
 {
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#ifdef VBOX_WS_X11
     /* Desktop event handlers: */
     connect(gpDesktop, SIGNAL(sigHostScreenWorkAreaResized(int)), this, SLOT(sltHandleHostScreenAvailableAreaChange()));
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
     /* Medium enumeration connections: */
@@ -2377,6 +2377,10 @@
     actionPool()->action(UIActionIndexST_M_Machine_T_Pause)->blockSignals(false);
 
-#if defined(VBOX_WS_MAC) && QT_VERSION < 0x050000
-    /* Avoid bug in Qt Cocoa which results in showing a "more arrow" on size-hint changes: */
+#ifdef VBOX_WS_MAC
+    // WORKAROUND:
+    // There is a bug in Qt Cocoa which result in showing a "more arrow" when
+    // the necessary size of the toolbar is increased. Also for some languages
+    // the with doesn't match if the text increase. So manually adjust the size
+    // after changing the text.
     m_pToolBar->updateLayout();
 #endif
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h	(revision 68315)
@@ -79,11 +79,11 @@
     void sltHandlePolishEvent();
 
-#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
+#if QT_VERSION == 0
+    /** Stupid moc does not warn if it cannot find headers! */
+    void QT_VERSION_NOT_DEFINED
+#elif defined(VBOX_WS_X11)
     /** Handles host-screen available-area change. */
     void sltHandleHostScreenAvailableAreaChange();
-#elif QT_VERSION == 0
-    /** Stupid moc does not warn if it cannot find headers! */
-    void QT_VERSION_NOT_DEFINED
-#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_X11 */
 
     /** Handles selector-window context-menu call for passed @a position. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 68315)
@@ -51,9 +51,4 @@
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-/* Qt includes: */
-#if QT_VERSION < 0x050000
-# include <QWindowsStyle>
-#endif /* QT_VERSION < 0x050000 */
 
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp	(revision 68315)
@@ -401,7 +401,5 @@
         m_fHovered = true;
         emit sigHoverEnter();
-#if QT_VERSION >= 0x050000
         update();
-#endif /* QT_VERSION >= 0x050000 */
     }
 }
@@ -413,7 +411,5 @@
         m_fHovered = false;
         emit sigHoverLeave();
-#if QT_VERSION >= 0x050000
         update();
-#endif /* QT_VERSION >= 0x050000 */
     }
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp	(revision 68315)
@@ -395,5 +395,4 @@
 
 #ifdef VBOX_WS_MAC
-# if QT_VERSION >= 0x050000
         /* Set composition-mode to opaque: */
         pPainter->setCompositionMode(QPainter::CompositionMode_Source);
@@ -402,5 +401,4 @@
         /* Return default composition-mode back: */
         pPainter->setCompositionMode(QPainter::CompositionMode_SourceAtop);
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 68315)
@@ -190,20 +190,4 @@
     int index = m_pages[cId];
 #ifdef VBOX_WS_MAC
-# if QT_VERSION < 0x050000
-    QSize cs = size();
-    if (index < m_sizeList.count())
-    {
-        QSize ss = m_sizeList.at(index);
-        /* Switch to the new page first if we are shrinking: */
-        if (cs.height() > ss.height())
-            m_pStack->setCurrentIndex(index);
-        /* Do the animation: */
-        ::darwinWindowAnimateResize(this, QRect (x(), y(), ss.width(), ss.height()));
-        /* Switch to the new page last if we are zooming: */
-        if (cs.height() <= ss.height())
-            m_pStack->setCurrentIndex(index);
-    }
-    ::darwinSetShowsResizeIndicator(this, false);
-# else /* QT_VERSION >= 0x050000 */
     /* If index is within the stored size list bounds: */
     if (index < m_sizeList.count())
@@ -234,5 +218,4 @@
         }
     }
-# endif /* QT_VERSION >= 0x050000 */
 #else
     m_pStack->setCurrentIndex(index);
@@ -632,32 +615,4 @@
     ::darwinSetHidesAllTitleButtons(this);
 
-# if QT_VERSION < 0x050000
-    /* Set all size policies to ignored: */
-    for (int i = 0; i < m_pStack->count(); ++i)
-        m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
-    /* Activate every single page to get the optimal size: */
-    for (int i = m_pStack->count() - 1; i >= 0; --i)
-    {
-        m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
-        /* Prevent this widgets to go in the Small/Mini size state which is
-         * available on Mac OS X. Not sure why this happens but this seems to help
-         * against. */
-        QList <QWidget*> list = m_pStack->widget(i)->findChildren<QWidget*>();
-        for (int a = 0; a < list.size(); ++a)
-        {
-            QWidget *w = list.at(a);
-            if (w->parent() == m_pStack->widget(i))
-                w->setFixedHeight(w->sizeHint().height());
-        }
-        m_pStack->setCurrentIndex(i);
-        /* Now make sure the layout is freshly calculated. */
-        layout()->activate();
-        QSize s = minimumSize();
-        if (iMinWidth > s.width())
-            s.setWidth(iMinWidth);
-        m_sizeList.insert(0, s);
-        m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
-    }
-# else /* QT_VERSION >= 0x050000 */
     /* Unlock all page policies initially: */
     for (int i = 0; i < m_pStack->count(); ++i)
@@ -695,5 +650,4 @@
         m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored);
     }
-# endif /* QT_VERSION >= 0x050000 */
 
     sltCategoryChanged(m_pSelector->currentId());
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp	(revision 68315)
@@ -822,11 +822,6 @@
     verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33));
     horizontalHeader()->setStretchLastSection(false);
-#if QT_VERSION >= 0x050000
     horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive);
     horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch);
-#else /* QT_VERSION < 0x050000 */
-    horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive);
-    horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch);
-#endif /* QT_VERSION < 0x050000 */
 
     /* Connect model: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp	(revision 68315)
@@ -1345,9 +1345,5 @@
                     m_pTreeViewSettings->header()->setStretchLastSection(true);
                     m_pTreeViewSettings->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
-#if QT_VERSION < 0x050000
-                    m_pTreeViewSettings->header()->setResizeMode(QHeaderView::ResizeToContents);
-#else
                     m_pTreeViewSettings->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
-#endif
 
                     /* Add tree-view into information layout: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp	(revision 68315)
@@ -71,7 +71,4 @@
     int h = 2 * frameWidth();
     int w = h;
-#if QT_VERSION < 0x040700
-    w += 4; // WTF?
-#endif /* QT_VERSION < 0x040700 */
     setFixedSize(sizeHintForColumn(0) + w,
                  sizeHintForRow(0) * count() + h);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp	(revision 68315)
@@ -45,7 +45,5 @@
 /* Qt includes: */
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
-#  include <QAbstractNativeEventFilter>
-# endif /* QT_VERSION >= 0x050000 */
+# include <QAbstractNativeEventFilter>
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 
@@ -71,14 +69,5 @@
 # include <X11/Xutil.h>
 # include <X11/keysym.h>
-# if QT_VERSION >= 0x050000
-#  include <xcb/xcb.h>
-# else /* QT_VERSION < 0x050000 */
-#  ifdef KeyPress
-const int XKeyPress = KeyPress;
-const int XKeyRelease = KeyRelease;
-#   undef KeyPress
-#   undef KeyRelease
-#  endif /* KeyPress */
-# endif /* QT_VERSION < 0x050000 */
+# include <xcb/xcb.h>
 #endif /* VBOX_WS_X11 */
 
@@ -88,5 +77,4 @@
 
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
 /** QAbstractNativeEventFilter extension
   * allowing to handle native platform events.
@@ -119,5 +107,4 @@
     UIHostComboEditorPrivate *m_pParent;
 };
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 
@@ -546,7 +533,5 @@
     , m_fStartNewSequence(true)
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
     , m_pPrivateEventFilter(0)
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 #ifdef VBOX_WS_WIN
@@ -566,17 +551,11 @@
 
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
     /* Prepare private event filter: */
     m_pPrivateEventFilter = new ComboEditorEventFilter(this);
     qApp->installNativeEventFilter(m_pPrivateEventFilter);
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 
 #if defined(VBOX_WS_MAC)
     m_uDarwinKeyModifiers = 0;
-# if QT_VERSION < 0x050000
-    UICocoaApplication::instance()->registerForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown  | NSKeyUp | | NSFlagsChanged */, UIHostComboEditorPrivate::darwinEventHandlerProc, this);
-    ::DarwinGrabKeyboard(false /* just modifiers */);
-# endif /* QT_VERSION < 0x050000 */
 #elif defined(VBOX_WS_WIN)
     /* Prepare AltGR monitor: */
@@ -590,10 +569,5 @@
 UIHostComboEditorPrivate::~UIHostComboEditorPrivate()
 {
-#if defined(VBOX_WS_MAC)
-# if QT_VERSION < 0x050000
-    ::DarwinReleaseKeyboard();
-    UICocoaApplication::instance()->unregisterForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown  | NSKeyUp | | NSFlagsChanged */, UIHostComboEditorPrivate::darwinEventHandlerProc, this);
-# endif /* QT_VERSION < 0x050000 */
-#elif defined(VBOX_WS_WIN)
+#if defined(VBOX_WS_WIN)
     /* Cleanup AltGR monitor: */
     delete m_pAltGrMonitor;
@@ -602,10 +576,8 @@
 
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
     /* Cleanup private event filter: */
     qApp->removeNativeEventFilter(m_pPrivateEventFilter);
     delete m_pPrivateEventFilter;
     m_pPrivateEventFilter = 0;
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 }
@@ -651,6 +623,4 @@
     emit sigDataChanged();
 }
-
-#if QT_VERSION >= 0x050000
 
 bool UIHostComboEditorPrivate::nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult)
@@ -800,139 +770,4 @@
 }
 
-#else /* QT_VERSION < 0x050000 */
-
-# if defined(VBOX_WS_MAC)
-
-/* static */
-bool UIHostComboEditorPrivate::darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser)
-{
-    UIHostComboEditorPrivate *pEditor = static_cast<UIHostComboEditorPrivate*>(pvUser);
-    EventRef inEvent = (EventRef)pvCarbonEvent;
-    UInt32 EventClass = ::GetEventClass(inEvent);
-    if (EventClass == kEventClassKeyboard)
-        return pEditor->darwinKeyboardEvent(pvCocoaEvent, inEvent);
-    return false;
-}
-
-bool UIHostComboEditorPrivate::darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent)
-{
-    /* Ignore key changes unless we're the focus widget: */
-    if (!hasFocus())
-        return false;
-
-    UInt32 eventKind = ::GetEventKind(inEvent);
-    switch (eventKind)
-    {
-        //case kEventRawKeyDown:
-        //case kEventRawKeyUp:
-        //case kEventRawKeyRepeat:
-        case kEventRawKeyModifiersChanged:
-        {
-            /* Get modifier mask: */
-            UInt32 modifierMask = 0;
-            ::GetEventParameter(inEvent, kEventParamKeyModifiers, typeUInt32, NULL,
-                                sizeof(modifierMask), NULL, &modifierMask);
-            modifierMask = ::DarwinAdjustModifierMask(modifierMask, pvCocoaEvent);
-            UInt32 changed = m_uDarwinKeyModifiers ^ modifierMask;
-
-            if (!changed)
-                break;
-
-            /* Convert to keycode: */
-            unsigned uKeyCode = ::DarwinModifierMaskToDarwinKeycode(changed);
-
-            if (!uKeyCode || uKeyCode == ~0U)
-                return false;
-
-            /* Process the key event: */
-            if (processKeyEvent(uKeyCode, changed & modifierMask))
-            {
-                /* Save the new modifier mask state. */
-                m_uDarwinKeyModifiers = modifierMask;
-                return true;
-            }
-            break;
-        }
-        default:
-            break;
-    }
-    return false;
-}
-
-# elif defined(VBOX_WS_WIN)
-
-bool UIHostComboEditorPrivate::winEvent(MSG *pMsg, long* /* pResult */)
-{
-    switch (pMsg->message)
-    {
-        case WM_KEYDOWN:
-        case WM_SYSKEYDOWN:
-        case WM_KEYUP:
-        case WM_SYSKEYUP:
-        {
-            /* Get key-code: */
-            int iKeyCode = UINativeHotKey::distinguishModifierVKey((int)pMsg->wParam, (int)pMsg->lParam);
-            unsigned iDownScanCode = (pMsg->lParam >> 16) & 0x7F;
-            bool fPressed = !(pMsg->lParam & 0x80000000);
-            bool fExtended = pMsg->lParam & 0x1000000;
-
-            /* If present - why not just assert this? */
-            if (m_pAltGrMonitor)
-            {
-                /* Update AltGR monitor state from key-event: */
-                m_pAltGrMonitor->updateStateFromKeyEvent(iDownScanCode, fPressed, fExtended);
-                /* And release left Ctrl key early (if required): */
-                if (m_pAltGrMonitor->isLeftControlReleaseNeeded())
-                {
-                    m_pressedKeys.remove(VK_LCONTROL);
-                    m_shownKeys.remove(VK_LCONTROL);
-                }
-                /* Fake LCtrl release events can also end up in the released
-                 * key set.  Detect them on the immediately following RAlt up. */
-                if (!m_pressedKeys.contains(VK_LCONTROL))
-                    m_releasedKeys.remove(VK_LCONTROL);
-            }
-
-            /* Process the key event: */
-            return processKeyEvent(iKeyCode, pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN);
-        }
-        default:
-            break;
-    }
-
-    return false;
-}
-
-# elif defined(VBOX_WS_X11)
-
-bool UIHostComboEditorPrivate::x11Event(XEvent *pEvent)
-{
-    switch (pEvent->type)
-    {
-        case XKeyPress:
-        case XKeyRelease:
-        {
-            /* Get key-code: */
-            XKeyEvent *pKeyEvent = (XKeyEvent*)pEvent;
-            RT_GCC_NO_WARN_DEPRECATED_BEGIN
-            KeySym ks = ::XKeycodeToKeysym(pKeyEvent->display, pKeyEvent->keycode, 0);
-            RT_GCC_NO_WARN_DEPRECATED_END
-
-            int iKeySym = (int)ks;
-
-            /* Process the key event: */
-            return processKeyEvent(iKeySym, pEvent->type == XKeyPress);
-        }
-        default:
-            break;
-    }
-
-    return false;
-}
-
-# endif /* VBOX_WS_X11 */
-
-#endif /* QT_VERSION < 0x050000 */
-
 void UIHostComboEditorPrivate::keyPressEvent(QKeyEvent *pEvent)
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h	(revision 68315)
@@ -32,7 +32,5 @@
 class UIHostComboEditorPrivate;
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
 class ComboEditorEventFilter;
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 #ifdef VBOX_WS_WIN
@@ -155,21 +153,6 @@
 protected:
 
-#if QT_VERSION >= 0x050000
     /** Qt5: Handles all native events. */
     bool nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult);
-#else /* QT_VERSION < 0x050000 */
-# if defined(VBOX_WS_MAC)
-    /** Mac: Qt4: Handles all native events (static callback). */
-    static bool darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
-    /** Mac: Qt4: Handles all native events. */
-    bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent);
-# elif defined(VBOX_WS_WIN)
-    /** Win: Qt4: Handles all native events. */
-    bool winEvent(MSG *pMsg, long *pResult);
-# elif defined(VBOX_WS_X11)
-    /** X11: Qt4: Handles all native events. */
-    bool x11Event(XEvent *pEvent);
-# endif /* VBOX_WS_X11 */
-#endif /* QT_VERSION < 0x050000 */
 
     void keyPressEvent(QKeyEvent *pEvent);
@@ -195,5 +178,4 @@
 
 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
-# if QT_VERSION >= 0x050000
     /** Mac, Win: Holds the native event filter instance. */
     ComboEditorEventFilter *m_pPrivateEventFilter;
@@ -201,5 +183,4 @@
       * redirect events directly to nativeEvent handler. */
     friend class ComboEditorEventFilter;
-# endif /* QT_VERSION >= 0x050000 */
 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp	(revision 68315)
@@ -31,10 +31,4 @@
 
 #endif /* VBOX_WS_MAC */
-
-/* Qt includes: */
-#if QT_VERSION < 0x050000
-# include <QWindowsStyle>
-# include <QCleanlooksStyle>
-#endif /* QT_VERSION < 0x050000 */
 
 
@@ -93,15 +87,7 @@
     setMovable(false);
 
-#if QT_VERSION < 0x050000
-    /* Remove that ugly frame panel around the toolbar.
-     * Doing that currently for Cleanlooks & Windows styles. */
-    if (qobject_cast <QWindowsStyle*>(QToolBar::style()) ||
-        qobject_cast <QCleanlooksStyle*>(QToolBar::style()))
+#ifdef VBOX_WS_MAC
         setStyleSheet("QToolBar { border: 0px none black; }");
-#else /* QT_VERSION >= 0x050000 */
-# ifdef VBOX_WS_MAC
-        setStyleSheet("QToolBar { border: 0px none black; }");
-# endif /* VBOX_WS_MAC */
-#endif /* QT_VERSION >= 0x050000 */
+#endif /* VBOX_WS_MAC */
 
     /* Configure tool-bar' layout: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp	(revision 68314)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp	(revision 68315)
@@ -80,10 +80,4 @@
 {
     setFinalPage(pButton != m_pFullCloneRadio);
-#if QT_VERSION < 0x040700
-    /* On older Qt versions the content of the current page isn't updated when
-     * using setFinalPage. So switch back and for to simulate it. */
-    wizard()->back();
-    wizard()->next();
-#endif /* QT_VERSION < 0x040700 */
 }
 
