Skip to content

Commit

Permalink
Take window frame into account when dragging dock widget
Browse files Browse the repository at this point in the history
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) <ogoffart@woboq.com>
  • Loading branch information
iamsergio authored and ogoffart committed Feb 16, 2017
1 parent cd2b5f1 commit 99ce1d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/widgets/widgets/qdockwidget.cpp
Expand Up @@ -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<QDockWidgetGroupWindow*>(parent);
if (floatingTab && !q->isFloating())
Expand Down

0 comments on commit 99ce1d3

Please sign in to comment.