From 5d22bfd65d6043ac201f9041d88d2c78eff0bc9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Tue, 6 Sep 2022 11:05:53 +0200 Subject: [PATCH] Refix QDockwidget drag out dockwidget In f082458c4609dfa20fdfb8bfe3e625c311b145da a fix attempt was made and in a lucky example on Mac it worked well. However, the logic was still not correct and that could be seen in other systems/examples. This patch updates the logic to be the correct behavior in general. Fixes: QTBUG-106064 Change-Id: I3b098be9942d37c367b146a7359185bcfd127762 Reviewed-by: Axel Spoerl Reviewed-by: Volker Hilsheimer (cherry picked from commit 06556d079afcf8c53c7dbbc0592988f52a23ff68) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/widgets/qdockwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 5ac6896a143..c66d2f8256a 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -788,7 +788,7 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca) state = new QDockWidgetPrivate::DragState; state->pressPos = pos; state->globalPressPos = q->mapToGlobal(pos); - state->widgetInitialPos = q->isFloating() ? q->pos() : q->mapToGlobal(q->pos()); + state->widgetInitialPos = q->isFloating() ? q->pos() : q->mapToGlobal(QPoint(0, 0)); state->dragging = false; state->widgetItem = nullptr; state->ownWidgetItem = false;