From b8879bb17b78c22e00b682a8e17c525c67b216b8 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Tue, 14 Nov 2023 10:26:09 +0100 Subject: [PATCH] QDockWidget: call raise() when a dock widget starts to hover When dock widget (1) starts to hover over another floating dock widget (2), the latter animates a rubber band, to indicate to the user that it is ready to accept a drop. The creation of a QRubberBand moves (2) one position up in the Z order. The consequence is a visual glitch: While - the mouse cursor dragging (1) is still outside (2) and - the visual rectangle of (1) starts overlapping (2) (1) hides behind (2). As soon as the mouse cursor enters (2), (1) suddenly comes on top and (2) hides behind (1). => raise() 1 as soon as it starts hovering. That brings it on top of the Z order, which is expected behavior. Pick-to: 6.5 Change-Id: I1140fc6ff109c7a713e7e2617072698467375585 Reviewed-by: Richard Moe Gustavsen Reviewed-by: David Faure (cherry picked from commit 1ab91b7bdbcced6ea4cc176da1d18e6b789208ae) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/widgets/qmainwindowlayout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 7aeab159ddf..660366f1cdc 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2791,6 +2791,7 @@ void QMainWindowLayout::hover(QLayoutItem *hoverTarget, QWidget *widget = hoverTarget->widget(); #if QT_CONFIG(dockwidget) + widget->raise(); if ((dockOptions & QMainWindow::GroupedDragging) && (qobject_cast(widget) || qobject_cast(widget))) {