From 99ce1d3d97c0423c3ee63ccf58deed964db0770e Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Wed, 15 Feb 2017 17:05:39 +0000 Subject: Take window frame into account when dragging dock widget Dock widgets with custom titlebar are frameless by default, so this isn't usually a problem. However, the user can override the default and make it non-frameless (by just removing the native title bar, not the frame). Task-number: QTBUG-58843 Change-Id: Iff7a2a719cb2f326f2f81bbfb1b53ba01a63f3e1 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets/widgets/qdockwidget.cpp') diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 53cb21186f..aa5d809431 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -930,7 +930,9 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) } if (state->dragging && !state->nca) { - QPoint pos = event->globalPos() - state->pressPos; + QMargins windowMargins = q->window()->windowHandle()->frameMargins(); + QPoint windowMarginOffset = QPoint(windowMargins.left(), windowMargins.top()); + QPoint pos = event->globalPos() - state->pressPos - windowMarginOffset; QDockWidgetGroupWindow *floatingTab = qobject_cast(parent); if (floatingTab && !q->isFloating()) -- cgit v1.2.3