Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp	(revision 97846)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp	(revision 97847)
@@ -559,467 +559,4 @@
     setMask(m_pToolbar->geometry());
 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
-}
-
-void UIMiniToolBar::sltHandleToolbarResize()
-{
-    /* Adjust geometry: */
-    adjustGeometry();
-}
-
-void UIMiniToolBar::sltAutoHideToggled()
-{
-    /* Propagate from child: */
-    setAutoHide(m_pToolbar->autoHide(), false);
-    emit sigAutoHideToggled(m_pToolbar->autoHide());
-}
-
-void UIMiniToolBar::sltHoverEnter()
-{
-    /* Mark as 'hovered' if necessary: */
-    if (!m_fHovered)
-    {
-        m_fHovered = true;
-        emit sigHoverEnter();
-    }
-}
-
-void UIMiniToolBar::sltHoverLeave()
-{
-    /* Mark as 'unhovered' if necessary: */
-    if (m_fHovered)
-    {
-        m_fHovered = false;
-        if (m_fAutoHide)
-            emit sigHoverLeave();
-    }
-}
-
-void UIMiniToolBar::sltCheckWindowActivationSanity()
-{
-    /* Do nothing if parent window is already active: */
-    if (   m_pParent
-        && QGuiApplication::focusWindow() == m_pParent->windowHandle())
-        return;
-
-    /* We can't touch window activation if have modal or popup
-     * window opened, otherwise internal Qt state get flawed: */
-    if (   QApplication::activeModalWidget()
-        || QApplication::activePopupWidget())
-    {
-        /* But we should recheck the state in let's say 300ms: */
-        QTimer::singleShot(300, this, SLOT(sltCheckWindowActivationSanity()));
-        return;
-    }
-
-    /* Notify listener about we have stole window activation: */
-    emit sigNotifyAboutWindowActivationStolen();
-}
-
-void UIMiniToolBar::sltHide()
-{
-    LogRel(("GUI: Hide mini-toolbar for window #%d\n", m_iWindowIndex));
-
-#if defined(VBOX_WS_MAC)
-
-    // Nothing
-
-#elif defined(VBOX_WS_WIN)
-
-    /* Reset window state to NONE and hide it: */
-    setWindowState(Qt::WindowNoState);
-    hide();
-
-#elif defined(VBOX_WS_X11)
-
-    /* Just hide window: */
-    hide();
-
-#else
-
-# warning "port me"
-
-#endif
-}
-
-void UIMiniToolBar::sltShow()
-{
-    LogRel(("GUI: Show mini-toolbar for window #%d\n", m_iWindowIndex));
-
-    /* Update transience: */
-    sltAdjustTransience();
-
-#if defined(VBOX_WS_MAC)
-
-    // Nothing
-
-#elif defined(VBOX_WS_WIN)
-
-    // WORKAROUND:
-    // If the host-screen is changed => we should
-    // reset window state to NONE first because
-    // we need an expose on showFullScreen call.
-    if (m_geometryType == GeometryType_Full)
-        setWindowState(Qt::WindowNoState);
-
-    /* Adjust window: */
-    sltAdjust();
-    /* Show window in necessary mode: */
-    switch (m_geometryType)
-    {
-        case GeometryType_Available:
-        {
-            /* Show normal: */
-            show();
-            break;
-        }
-        case GeometryType_Full:
-        {
-            /* Show full-screen: */
-            showFullScreen();
-            break;
-        }
-    }
-
-#elif defined(VBOX_WS_X11)
-
-    /* Show window in necessary mode: */
-    switch (m_geometryType)
-    {
-        case GeometryType_Available:
-        {
-            /* Adjust window: */
-            sltAdjust();
-            /* Show maximized: */
-            if (!isMaximized())
-                showMaximized();
-            break;
-        }
-        case GeometryType_Full:
-        {
-            /* Show full-screen: */
-            showFullScreen();
-            /* Adjust window: */
-            sltAdjust();
-            break;
-        }
-    }
-
-#else
-
-# warning "port me"
-
-#endif
-
-    /* Simulate toolbar auto-hiding: */
-    simulateToolbarAutoHiding();
-}
-
-void UIMiniToolBar::sltAdjust()
-{
-    LogRel(("GUI: Adjust mini-toolbar for window #%d\n", m_iWindowIndex));
-
-    /* Get corresponding host-screen: */
-    const int iHostScreenCount = UIDesktopWidgetWatchdog::screenCount();
-    int iHostScreen = UIDesktopWidgetWatchdog::screenNumber(m_pParent);
-    // WORKAROUND:
-    // When switching host-screen count, especially in complex cases where RDP client is "replacing" host-screen(s) with own virtual-screen(s),
-    // Qt could behave quite arbitrary and laggy, and due to racing there could be a situation when QDesktopWidget::screenNumber() returns -1
-    // as a host-screen number where the parent window is currently located. We should handle this situation anyway, so let's assume the parent
-    // window is located on primary (0) host-screen if it's present or ignore this request at all.
-    if (iHostScreen < 0 || iHostScreen >= iHostScreenCount)
-    {
-        if (iHostScreenCount > 0)
-        {
-            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Fallback to primary.\n", m_iWindowIndex, iHostScreen));
-            iHostScreen = 0;
-        }
-        else
-        {
-            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Ignore request.\n", m_iWindowIndex, iHostScreen));
-            return;
-        }
-    }
-
-    /* Get corresponding working area: */
-    QRect workingArea;
-    switch (m_geometryType)
-    {
-        case GeometryType_Available: workingArea = gpDesktop->availableGeometry(iHostScreen); break;
-        case GeometryType_Full:      workingArea = gpDesktop->screenGeometry(iHostScreen); break;
-    }
-    Q_UNUSED(workingArea);
-
-#if defined(VBOX_WS_MAC)
-
-    // Nothing
-
-#elif defined(VBOX_WS_WIN)
-
-    switch (m_geometryType)
-    {
-        case GeometryType_Available:
-        {
-            /* Set appropriate window size: */
-            const QSize newSize = workingArea.size();
-            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
-                     m_iWindowIndex, newSize.width(), newSize.height()));
-            resize(newSize);
-
-            /* Move window onto required screen: */
-            const QPoint newPosition = workingArea.topLeft();
-            LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
-                     m_iWindowIndex, newPosition.x(), newPosition.y()));
-            move(newPosition);
-
-            break;
-        }
-        case GeometryType_Full:
-        {
-            /* Map window onto required screen: */
-            LogRel(("GUI:  Map mini-toolbar for window #%d to screen %d of %d\n",
-                     m_iWindowIndex, iHostScreen, qApp->screens().size()));
-            windowHandle()->setScreen(qApp->screens().at(iHostScreen));
-
-            /* Set appropriate window size: */
-            const QSize newSize = workingArea.size();
-            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
-                     m_iWindowIndex, newSize.width(), newSize.height()));
-            resize(newSize);
-
-            break;
-        }
-    }
-
-#elif defined(VBOX_WS_X11)
-
-    switch (m_geometryType)
-    {
-        case GeometryType_Available:
-        {
-            /* Make sure we are located on corresponding host-screen: */
-            if (   UIDesktopWidgetWatchdog::screenCount() > 1
-                && (x() != workingArea.x() || y() != workingArea.y()))
-            {
-                // WORKAROUND:
-                // With Qt5 on KDE we can't just move the window onto desired host-screen if
-                // window is maximized. So we have to show it normal first of all:
-                if (isVisible() && isMaximized())
-                    showNormal();
-
-                // WORKAROUND:
-                // With Qt5 on X11 we can't just move the window onto desired host-screen if
-                // window size is more than the available geometry (working area) of that
-                // host-screen. So we are resizing it to a smaller size first of all:
-                const QSize newSize = workingArea.size() * .9;
-                LogRel(("GUI:  Resize mini-toolbar for window #%d to smaller size %dx%d\n",
-                        m_iWindowIndex, newSize.width(), newSize.height()));
-                resize(newSize);
-
-                /* Move window onto required screen: */
-                const QPoint newPosition = workingArea.topLeft();
-                LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
-                        m_iWindowIndex, newPosition.x(), newPosition.y()));
-                move(newPosition);
-            }
-
-            break;
-        }
-        case GeometryType_Full:
-        {
-            /* Determine whether we should use the native full-screen mode: */
-            const bool fUseNativeFullScreen =    NativeWindowSubsystem::X11SupportsFullScreenMonitorsProtocol()
-                                              && !gEDataManager->legacyFullscreenModeRequested();
-            if (fUseNativeFullScreen)
-            {
-                /* Tell recent window managers which host-screen this window should be mapped to: */
-                NativeWindowSubsystem::X11SetFullScreenMonitor(this, iHostScreen);
-            }
-
-            /* Set appropriate window size: */
-            const QSize newSize = workingArea.size();
-            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
-                    m_iWindowIndex, newSize.width(), newSize.height()));
-            resize(newSize);
-
-            /* Move window onto required screen: */
-            const QPoint newPosition = workingArea.topLeft();
-            LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
-                    m_iWindowIndex, newPosition.x(), newPosition.y()));
-            move(newPosition);
-
-            /* Re-apply the full-screen state lost on above move(): */
-            setWindowState(Qt::WindowFullScreen);
-
-            break;
-        }
-    }
-
-#else
-
-# warning "port me"
-
-#endif
-}
-
-void UIMiniToolBar::sltAdjustTransience()
-{
-    // WORKAROUND:
-    // Make sure win id is generated,
-    // else Qt5 can crash otherwise.
-    winId();
-    m_pParent->winId();
-
-    /* Add the transience dependency: */
-    windowHandle()->setTransientParent(m_pParent->windowHandle());
-}
-
-void UIMiniToolBar::prepare()
-{
-    /* Install event-filters: */
-    installEventFilter(this);
-    m_pParent->installEventFilter(this);
-
-#if   defined(VBOX_WS_WIN)
-    /* No background until first paint-event: */
-    setAttribute(Qt::WA_NoSystemBackground);
-    /* Enable translucency through Qt API: */
-    setAttribute(Qt::WA_TranslucentBackground);
-#elif defined(VBOX_WS_X11)
-    /* Enable translucency through Qt API if supported: */
-    if (uiCommon().isCompositingManagerRunning())
-        setAttribute(Qt::WA_TranslucentBackground);
-#endif /* VBOX_WS_X11 */
-
-    /* Make sure we have no focus: */
-    setFocusPolicy(Qt::NoFocus);
-
-    /* Prepare area: */
-    m_pArea = new QWidget;
-    {
-        /* Allow any area size: */
-        m_pArea->setMinimumSize(QSize(1, 1));
-        /* Configure own background: */
-        QPalette pal = m_pArea->palette();
-        pal.setColor(QPalette::Window, QColor(Qt::transparent));
-        m_pArea->setPalette(pal);
-        /* Layout area according parent-widget: */
-        QVBoxLayout *pMainLayout = new QVBoxLayout(this);
-        pMainLayout->setContentsMargins(0, 0, 0, 0);
-        pMainLayout->addWidget(m_pArea);
-        /* Make sure we have no focus: */
-        m_pArea->setFocusPolicy(Qt::NoFocus);
-    }
-
-    /* Prepare mini-toolbar: */
-    m_pToolbar = new UIMiniToolBarPrivate;
-    {
-        /* Make sure we have no focus: */
-        m_pToolbar->setFocusPolicy(Qt::NoFocus);
-        /* Propagate known options to child: */
-        m_pToolbar->setAutoHide(m_fAutoHide);
-        m_pToolbar->setAlignment(m_alignment);
-        /* Configure own background: */
-        QPalette pal = m_pToolbar->palette();
-        pal.setColor(QPalette::Window, QApplication::palette().color(QPalette::Window));
-        m_pToolbar->setPalette(pal);
-        /* Configure child connections: */
-        connect(m_pToolbar, &UIMiniToolBarPrivate::sigResized, this, &UIMiniToolBar::sltHandleToolbarResize);
-        connect(m_pToolbar, &UIMiniToolBarPrivate::sigAutoHideToggled, this, &UIMiniToolBar::sltAutoHideToggled);
-        connect(m_pToolbar, &UIMiniToolBarPrivate::sigMinimizeAction, this, &UIMiniToolBar::sigMinimizeAction);
-        connect(m_pToolbar, &UIMiniToolBarPrivate::sigExitAction, this, &UIMiniToolBar::sigExitAction);
-        connect(m_pToolbar, &UIMiniToolBarPrivate::sigCloseAction, this, &UIMiniToolBar::sigCloseAction);
-        /* Add child to area: */
-        m_pToolbar->setParent(m_pArea);
-        /* Make sure we have no focus: */
-        m_pToolbar->setFocusPolicy(Qt::NoFocus);
-    }
-
-    /* Prepare hover-enter/leave timers: */
-    m_pHoverEnterTimer = new QTimer(this);
-    {
-        m_pHoverEnterTimer->setSingleShot(true);
-        m_pHoverEnterTimer->setInterval(500);
-        connect(m_pHoverEnterTimer, &QTimer::timeout, this, &UIMiniToolBar::sltHoverEnter);
-    }
-    m_pHoverLeaveTimer = new QTimer(this);
-    {
-        m_pHoverLeaveTimer->setSingleShot(true);
-        m_pHoverLeaveTimer->setInterval(500);
-        connect(m_pHoverLeaveTimer, &QTimer::timeout, this, &UIMiniToolBar::sltHoverLeave);
-    }
-
-    /* Install 'auto-hide' animation to 'toolbarPosition' property: */
-    m_pAnimation = UIAnimation::installPropertyAnimation(this,
-                                                         "toolbarPosition",
-                                                         "hiddenToolbarPosition", "shownToolbarPosition",
-                                                         SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()),
-                                                         true);
-
-    /* Adjust geometry first time: */
-    adjustGeometry();
-
-#ifdef VBOX_WS_X11
-    /* Hide mini-toolbar from taskbar and pager: */
-    NativeWindowSubsystem::X11SetSkipTaskBarFlag(this);
-    NativeWindowSubsystem::X11SetSkipPagerFlag(this);
-#endif
-}
-
-void UIMiniToolBar::cleanup()
-{
-    /* Stop hover-enter/leave timers: */
-    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
-        m_pHoverEnterTimer->stop();
-    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
-        m_pHoverLeaveTimer->stop();
-
-    /* Destroy animation before toolbar: */
-    delete m_pAnimation;
-    m_pAnimation = 0;
-
-    /* Destroy toolbar after animation: */
-    delete m_pToolbar;
-    m_pToolbar = 0;
-}
-
-void UIMiniToolBar::enterEvent(QEvent*)
-{
-    /* Stop the hover-leave timer if necessary: */
-    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
-        m_pHoverLeaveTimer->stop();
-
-    /* Start the hover-enter timer: */
-    if (m_pHoverEnterTimer)
-        m_pHoverEnterTimer->start();
-}
-
-void UIMiniToolBar::leaveEvent(QEvent*)
-{
-    // WORKAROUND:
-    // No idea why, but GUI receives mouse leave event
-    // when the mouse cursor is on the border of screen
-    // even if underlying widget is on the border of
-    // screen as well, we should detect and ignore that.
-    // Besides that, this is a good way to keep the
-    // tool-bar visible when the mouse moving through
-    // the desktop strut till the real screen border.
-    const QPoint cursorPosition = QCursor::pos();
-    if (   cursorPosition.y() <= y() + 1
-        || cursorPosition.y() >= y() + height() - 1)
-        return;
-
-    /* Stop the hover-enter timer if necessary: */
-    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
-        m_pHoverEnterTimer->stop();
-
-    /* Start the hover-leave timer: */
-    if (m_fAutoHide && m_pHoverLeaveTimer)
-        m_pHoverLeaveTimer->start();
-}
-
-void UIMiniToolBar::resizeEvent(QResizeEvent*)
-{
-    /* Adjust geometry: */
-    adjustGeometry();
 }
 
@@ -1167,4 +704,471 @@
 }
 
+void UIMiniToolBar::resizeEvent(QResizeEvent*)
+{
+    /* Adjust geometry: */
+    adjustGeometry();
+}
+
+#ifdef VBOX_IS_QT6_OR_LATER
+void UIMiniToolBar::enterEvent(QEnterEvent*)
+#else
+void UIMiniToolBar::enterEvent(QEvent*)
+#endif
+{
+    /* Stop the hover-leave timer if necessary: */
+    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
+        m_pHoverLeaveTimer->stop();
+
+    /* Start the hover-enter timer: */
+    if (m_pHoverEnterTimer)
+        m_pHoverEnterTimer->start();
+}
+
+void UIMiniToolBar::leaveEvent(QEvent*)
+{
+    // WORKAROUND:
+    // No idea why, but GUI receives mouse leave event
+    // when the mouse cursor is on the border of screen
+    // even if underlying widget is on the border of
+    // screen as well, we should detect and ignore that.
+    // Besides that, this is a good way to keep the
+    // tool-bar visible when the mouse moving through
+    // the desktop strut till the real screen border.
+    const QPoint cursorPosition = QCursor::pos();
+    if (   cursorPosition.y() <= y() + 1
+        || cursorPosition.y() >= y() + height() - 1)
+        return;
+
+    /* Stop the hover-enter timer if necessary: */
+    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
+        m_pHoverEnterTimer->stop();
+
+    /* Start the hover-leave timer: */
+    if (m_fAutoHide && m_pHoverLeaveTimer)
+        m_pHoverLeaveTimer->start();
+}
+
+void UIMiniToolBar::sltHandleToolbarResize()
+{
+    /* Adjust geometry: */
+    adjustGeometry();
+}
+
+void UIMiniToolBar::sltAutoHideToggled()
+{
+    /* Propagate from child: */
+    setAutoHide(m_pToolbar->autoHide(), false);
+    emit sigAutoHideToggled(m_pToolbar->autoHide());
+}
+
+void UIMiniToolBar::sltHoverEnter()
+{
+    /* Mark as 'hovered' if necessary: */
+    if (!m_fHovered)
+    {
+        m_fHovered = true;
+        emit sigHoverEnter();
+    }
+}
+
+void UIMiniToolBar::sltHoverLeave()
+{
+    /* Mark as 'unhovered' if necessary: */
+    if (m_fHovered)
+    {
+        m_fHovered = false;
+        if (m_fAutoHide)
+            emit sigHoverLeave();
+    }
+}
+
+void UIMiniToolBar::sltCheckWindowActivationSanity()
+{
+    /* Do nothing if parent window is already active: */
+    if (   m_pParent
+        && QGuiApplication::focusWindow() == m_pParent->windowHandle())
+        return;
+
+    /* We can't touch window activation if have modal or popup
+     * window opened, otherwise internal Qt state get flawed: */
+    if (   QApplication::activeModalWidget()
+        || QApplication::activePopupWidget())
+    {
+        /* But we should recheck the state in let's say 300ms: */
+        QTimer::singleShot(300, this, SLOT(sltCheckWindowActivationSanity()));
+        return;
+    }
+
+    /* Notify listener about we have stole window activation: */
+    emit sigNotifyAboutWindowActivationStolen();
+}
+
+void UIMiniToolBar::sltHide()
+{
+    LogRel(("GUI: Hide mini-toolbar for window #%d\n", m_iWindowIndex));
+
+#if defined(VBOX_WS_MAC)
+
+    // Nothing
+
+#elif defined(VBOX_WS_WIN)
+
+    /* Reset window state to NONE and hide it: */
+    setWindowState(Qt::WindowNoState);
+    hide();
+
+#elif defined(VBOX_WS_X11)
+
+    /* Just hide window: */
+    hide();
+
+#else
+
+# warning "port me"
+
+#endif
+}
+
+void UIMiniToolBar::sltShow()
+{
+    LogRel(("GUI: Show mini-toolbar for window #%d\n", m_iWindowIndex));
+
+    /* Update transience: */
+    sltAdjustTransience();
+
+#if defined(VBOX_WS_MAC)
+
+    // Nothing
+
+#elif defined(VBOX_WS_WIN)
+
+    // WORKAROUND:
+    // If the host-screen is changed => we should
+    // reset window state to NONE first because
+    // we need an expose on showFullScreen call.
+    if (m_geometryType == GeometryType_Full)
+        setWindowState(Qt::WindowNoState);
+
+    /* Adjust window: */
+    sltAdjust();
+    /* Show window in necessary mode: */
+    switch (m_geometryType)
+    {
+        case GeometryType_Available:
+        {
+            /* Show normal: */
+            show();
+            break;
+        }
+        case GeometryType_Full:
+        {
+            /* Show full-screen: */
+            showFullScreen();
+            break;
+        }
+    }
+
+#elif defined(VBOX_WS_X11)
+
+    /* Show window in necessary mode: */
+    switch (m_geometryType)
+    {
+        case GeometryType_Available:
+        {
+            /* Adjust window: */
+            sltAdjust();
+            /* Show maximized: */
+            if (!isMaximized())
+                showMaximized();
+            break;
+        }
+        case GeometryType_Full:
+        {
+            /* Show full-screen: */
+            showFullScreen();
+            /* Adjust window: */
+            sltAdjust();
+            break;
+        }
+    }
+
+#else
+
+# warning "port me"
+
+#endif
+
+    /* Simulate toolbar auto-hiding: */
+    simulateToolbarAutoHiding();
+}
+
+void UIMiniToolBar::sltAdjust()
+{
+    LogRel(("GUI: Adjust mini-toolbar for window #%d\n", m_iWindowIndex));
+
+    /* Get corresponding host-screen: */
+    const int iHostScreenCount = UIDesktopWidgetWatchdog::screenCount();
+    int iHostScreen = UIDesktopWidgetWatchdog::screenNumber(m_pParent);
+    // WORKAROUND:
+    // When switching host-screen count, especially in complex cases where RDP client is "replacing" host-screen(s) with own virtual-screen(s),
+    // Qt could behave quite arbitrary and laggy, and due to racing there could be a situation when QDesktopWidget::screenNumber() returns -1
+    // as a host-screen number where the parent window is currently located. We should handle this situation anyway, so let's assume the parent
+    // window is located on primary (0) host-screen if it's present or ignore this request at all.
+    if (iHostScreen < 0 || iHostScreen >= iHostScreenCount)
+    {
+        if (iHostScreenCount > 0)
+        {
+            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Fallback to primary.\n", m_iWindowIndex, iHostScreen));
+            iHostScreen = 0;
+        }
+        else
+        {
+            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Ignore request.\n", m_iWindowIndex, iHostScreen));
+            return;
+        }
+    }
+
+    /* Get corresponding working area: */
+    QRect workingArea;
+    switch (m_geometryType)
+    {
+        case GeometryType_Available: workingArea = gpDesktop->availableGeometry(iHostScreen); break;
+        case GeometryType_Full:      workingArea = gpDesktop->screenGeometry(iHostScreen); break;
+    }
+    Q_UNUSED(workingArea);
+
+#if defined(VBOX_WS_MAC)
+
+    // Nothing
+
+#elif defined(VBOX_WS_WIN)
+
+    switch (m_geometryType)
+    {
+        case GeometryType_Available:
+        {
+            /* Set appropriate window size: */
+            const QSize newSize = workingArea.size();
+            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
+                     m_iWindowIndex, newSize.width(), newSize.height()));
+            resize(newSize);
+
+            /* Move window onto required screen: */
+            const QPoint newPosition = workingArea.topLeft();
+            LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
+                     m_iWindowIndex, newPosition.x(), newPosition.y()));
+            move(newPosition);
+
+            break;
+        }
+        case GeometryType_Full:
+        {
+            /* Map window onto required screen: */
+            LogRel(("GUI:  Map mini-toolbar for window #%d to screen %d of %d\n",
+                     m_iWindowIndex, iHostScreen, qApp->screens().size()));
+            windowHandle()->setScreen(qApp->screens().at(iHostScreen));
+
+            /* Set appropriate window size: */
+            const QSize newSize = workingArea.size();
+            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
+                     m_iWindowIndex, newSize.width(), newSize.height()));
+            resize(newSize);
+
+            break;
+        }
+    }
+
+#elif defined(VBOX_WS_X11)
+
+    switch (m_geometryType)
+    {
+        case GeometryType_Available:
+        {
+            /* Make sure we are located on corresponding host-screen: */
+            if (   UIDesktopWidgetWatchdog::screenCount() > 1
+                && (x() != workingArea.x() || y() != workingArea.y()))
+            {
+                // WORKAROUND:
+                // With Qt5 on KDE we can't just move the window onto desired host-screen if
+                // window is maximized. So we have to show it normal first of all:
+                if (isVisible() && isMaximized())
+                    showNormal();
+
+                // WORKAROUND:
+                // With Qt5 on X11 we can't just move the window onto desired host-screen if
+                // window size is more than the available geometry (working area) of that
+                // host-screen. So we are resizing it to a smaller size first of all:
+                const QSize newSize = workingArea.size() * .9;
+                LogRel(("GUI:  Resize mini-toolbar for window #%d to smaller size %dx%d\n",
+                        m_iWindowIndex, newSize.width(), newSize.height()));
+                resize(newSize);
+
+                /* Move window onto required screen: */
+                const QPoint newPosition = workingArea.topLeft();
+                LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
+                        m_iWindowIndex, newPosition.x(), newPosition.y()));
+                move(newPosition);
+            }
+
+            break;
+        }
+        case GeometryType_Full:
+        {
+            /* Determine whether we should use the native full-screen mode: */
+            const bool fUseNativeFullScreen =    NativeWindowSubsystem::X11SupportsFullScreenMonitorsProtocol()
+                                              && !gEDataManager->legacyFullscreenModeRequested();
+            if (fUseNativeFullScreen)
+            {
+                /* Tell recent window managers which host-screen this window should be mapped to: */
+                NativeWindowSubsystem::X11SetFullScreenMonitor(this, iHostScreen);
+            }
+
+            /* Set appropriate window size: */
+            const QSize newSize = workingArea.size();
+            LogRel(("GUI:  Resize mini-toolbar for window #%d to %dx%d\n",
+                    m_iWindowIndex, newSize.width(), newSize.height()));
+            resize(newSize);
+
+            /* Move window onto required screen: */
+            const QPoint newPosition = workingArea.topLeft();
+            LogRel(("GUI:  Move mini-toolbar for window #%d to %dx%d\n",
+                    m_iWindowIndex, newPosition.x(), newPosition.y()));
+            move(newPosition);
+
+            /* Re-apply the full-screen state lost on above move(): */
+            setWindowState(Qt::WindowFullScreen);
+
+            break;
+        }
+    }
+
+#else
+
+# warning "port me"
+
+#endif
+}
+
+void UIMiniToolBar::sltAdjustTransience()
+{
+    // WORKAROUND:
+    // Make sure win id is generated,
+    // else Qt5 can crash otherwise.
+    winId();
+    m_pParent->winId();
+
+    /* Add the transience dependency: */
+    windowHandle()->setTransientParent(m_pParent->windowHandle());
+}
+
+void UIMiniToolBar::prepare()
+{
+    /* Install event-filters: */
+    installEventFilter(this);
+    m_pParent->installEventFilter(this);
+
+#if   defined(VBOX_WS_WIN)
+    /* No background until first paint-event: */
+    setAttribute(Qt::WA_NoSystemBackground);
+    /* Enable translucency through Qt API: */
+    setAttribute(Qt::WA_TranslucentBackground);
+#elif defined(VBOX_WS_X11)
+    /* Enable translucency through Qt API if supported: */
+    if (uiCommon().isCompositingManagerRunning())
+        setAttribute(Qt::WA_TranslucentBackground);
+#endif /* VBOX_WS_X11 */
+
+    /* Make sure we have no focus: */
+    setFocusPolicy(Qt::NoFocus);
+
+    /* Prepare area: */
+    m_pArea = new QWidget;
+    {
+        /* Allow any area size: */
+        m_pArea->setMinimumSize(QSize(1, 1));
+        /* Configure own background: */
+        QPalette pal = m_pArea->palette();
+        pal.setColor(QPalette::Window, QColor(Qt::transparent));
+        m_pArea->setPalette(pal);
+        /* Layout area according parent-widget: */
+        QVBoxLayout *pMainLayout = new QVBoxLayout(this);
+        pMainLayout->setContentsMargins(0, 0, 0, 0);
+        pMainLayout->addWidget(m_pArea);
+        /* Make sure we have no focus: */
+        m_pArea->setFocusPolicy(Qt::NoFocus);
+    }
+
+    /* Prepare mini-toolbar: */
+    m_pToolbar = new UIMiniToolBarPrivate;
+    {
+        /* Make sure we have no focus: */
+        m_pToolbar->setFocusPolicy(Qt::NoFocus);
+        /* Propagate known options to child: */
+        m_pToolbar->setAutoHide(m_fAutoHide);
+        m_pToolbar->setAlignment(m_alignment);
+        /* Configure own background: */
+        QPalette pal = m_pToolbar->palette();
+        pal.setColor(QPalette::Window, QApplication::palette().color(QPalette::Window));
+        m_pToolbar->setPalette(pal);
+        /* Configure child connections: */
+        connect(m_pToolbar, &UIMiniToolBarPrivate::sigResized, this, &UIMiniToolBar::sltHandleToolbarResize);
+        connect(m_pToolbar, &UIMiniToolBarPrivate::sigAutoHideToggled, this, &UIMiniToolBar::sltAutoHideToggled);
+        connect(m_pToolbar, &UIMiniToolBarPrivate::sigMinimizeAction, this, &UIMiniToolBar::sigMinimizeAction);
+        connect(m_pToolbar, &UIMiniToolBarPrivate::sigExitAction, this, &UIMiniToolBar::sigExitAction);
+        connect(m_pToolbar, &UIMiniToolBarPrivate::sigCloseAction, this, &UIMiniToolBar::sigCloseAction);
+        /* Add child to area: */
+        m_pToolbar->setParent(m_pArea);
+        /* Make sure we have no focus: */
+        m_pToolbar->setFocusPolicy(Qt::NoFocus);
+    }
+
+    /* Prepare hover-enter/leave timers: */
+    m_pHoverEnterTimer = new QTimer(this);
+    {
+        m_pHoverEnterTimer->setSingleShot(true);
+        m_pHoverEnterTimer->setInterval(500);
+        connect(m_pHoverEnterTimer, &QTimer::timeout, this, &UIMiniToolBar::sltHoverEnter);
+    }
+    m_pHoverLeaveTimer = new QTimer(this);
+    {
+        m_pHoverLeaveTimer->setSingleShot(true);
+        m_pHoverLeaveTimer->setInterval(500);
+        connect(m_pHoverLeaveTimer, &QTimer::timeout, this, &UIMiniToolBar::sltHoverLeave);
+    }
+
+    /* Install 'auto-hide' animation to 'toolbarPosition' property: */
+    m_pAnimation = UIAnimation::installPropertyAnimation(this,
+                                                         "toolbarPosition",
+                                                         "hiddenToolbarPosition", "shownToolbarPosition",
+                                                         SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()),
+                                                         true);
+
+    /* Adjust geometry first time: */
+    adjustGeometry();
+
+#ifdef VBOX_WS_X11
+    /* Hide mini-toolbar from taskbar and pager: */
+    NativeWindowSubsystem::X11SetSkipTaskBarFlag(this);
+    NativeWindowSubsystem::X11SetSkipPagerFlag(this);
+#endif
+}
+
+void UIMiniToolBar::cleanup()
+{
+    /* Stop hover-enter/leave timers: */
+    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
+        m_pHoverEnterTimer->stop();
+    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
+        m_pHoverLeaveTimer->stop();
+
+    /* Destroy animation before toolbar: */
+    delete m_pAnimation;
+    m_pAnimation = 0;
+
+    /* Destroy toolbar after animation: */
+    delete m_pToolbar;
+    m_pToolbar = 0;
+}
+
 void UIMiniToolBar::simulateToolbarAutoHiding()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h	(revision 97846)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h	(revision 97847)
@@ -117,4 +117,22 @@
     void adjustGeometry();
 
+protected:
+
+    /** Filters @a pEvent if <i>this</i> object has been
+      * installed as an event-filter for the @a pWatched. */
+    virtual bool eventFilter(QObject *pWatched, QEvent *pEvent) RT_OVERRIDE;
+
+    /** Resize @a pEvent handler. */
+    virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
+
+    /** Mouse enter @a pEvent handler. */
+#ifdef VBOX_IS_QT6_OR_LATER
+    virtual void enterEvent(QEnterEvent *pEvent) RT_OVERRIDE;
+#else
+    virtual void enterEvent(QEvent *pEvent) RT_OVERRIDE;
+#endif
+    /** Mouse leave @a pEvent handler. */
+    virtual void leaveEvent(QEvent *pEvent) RT_OVERRIDE;
+
 private slots:
 
@@ -148,16 +166,4 @@
     /** Cleanup routine. */
     void cleanup();
-
-    /** Mouse enter @a pEvent handler. */
-    void enterEvent(QEvent *pEvent);
-    /** Mouse leave @a pEvent handler. */
-    void leaveEvent(QEvent *pEvent);
-
-    /** Resize @a pEvent handler. */
-    void resizeEvent(QResizeEvent *pEvent);
-
-    /** Filters @a pEvent if <i>this</i> object has been
-      * installed as an event-filter for the @a pWatched. */
-    bool eventFilter(QObject *pWatched, QEvent *pEvent);
 
     /** Simulates auto-hide animation. */
