Fix dragging a docked QDockWidget [REG-fix]

In 54f328f0e8205480749a6d8d2ebe0e58cb1cdb67 issues with dragging
dock widgets between screens were solved. However, it only
worked well if the widget was floating. It worked wrong when
dragging out a docked widget. That is fixed by this patch.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-106064
Change-Id: I8d486d30a334719a2931828464ccaceb8ba2e019
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thorbjørn Lund Martsum 2022-08-31 11:28:50 +02:00
parent f123212880
commit f082458c46

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->pos();
state->widgetInitialPos = q->isFloating() ? q->pos() : q->mapToGlobal(q->pos());
state->dragging = false;
state->widgetItem = nullptr;
state->ownWidgetItem = false;