From 837c388dd3549c9bbab8916570440342d82fcdb3 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 21 May 2019 22:38:59 +0100 Subject: dockwidgets: Unbreak moving floating dock widgets with custom titlebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f1033567aa4 improved resize of windows with custom titlebar by adding more margin, but the check was too tight. d2d6c6f7813 tried to fix the regression, but not totally The mode is only set *after* the mouse press. It will always be NoWhere the first time, so that check will always discard the mouse press, making moving the window always fail the first time. Also, if the rect+range contains the press, then surely the mode won't be nowhere once set. There's still room for optimization, like bailing out early it was the right button instead of the left button, but that's out of scope for this bug fix, and also not worth for 5.12 branch. To reproduce the bug, simply: - Run examples/widgets/mainwindows/mainwindow - Click the red button of the blue dock widget, to make it float - Drag the title bar (not too slow). Fixes: QTBUG-66454 Change-Id: I0eebfb932dab95267ebadccd757de11a8bfe419d Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw Reviewed-by: Nathan Collins Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/widgets/qwidgetresizehandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/widgets/qwidgetresizehandler.cpp') diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index 7ed6f6d78d..e8d435429f 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -121,7 +121,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee) break; const QRect widgetRect = widget->rect().marginsAdded(QMargins(range, range, range, range)); const QPoint cursorPoint = widget->mapFromGlobal(e->globalPos()); - if (!widgetRect.contains(cursorPoint) || mode == Nowhere) + if (!widgetRect.contains(cursorPoint)) return false; if (e->button() == Qt::LeftButton) { #if 0 // Used to be included in Qt4 for Q_WS_X11 -- cgit v1.2.3