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 <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 06556d079afcf8c53c7dbbc0592988f52a23ff68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thorbjørn Lund Martsum 2022-09-06 11:05:53 +02:00 committed by Qt Cherry-pick Bot
parent b3bb20b8bc
commit 42c7bb44f9

View File

@ -754,7 +754,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;