diff options
author | Sergio Martins <iamsergio@gmail.com> | 2019-05-21 22:38:59 +0100 |
---|---|---|
committer | Sergio Martins <iamsergio@gmail.com> | 2019-05-21 22:49:33 +0100 |
commit | 837c388dd3549c9bbab8916570440342d82fcdb3 (patch) | |
tree | 129790d0a8d34953f33f29b49130b60e37b51e6f /src | |
parent | 2ed4fcca196ac3fd34a3e41f2e0b3d346a5470b9 (diff) |
dockwidgets: Unbreak moving floating dock widgets with custom titlebar
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 <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Nathan Collins <nathan.collins@kdab.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qwidgetresizehandler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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 |