diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2017-10-09 14:08:23 +0200 |
---|---|---|
committer | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2017-10-10 14:43:34 +0000 |
commit | f1033567aa4295d5e0122f01c7781a8b23d0d781 (patch) | |
tree | 921a0379955d7f7e8b51cb858d8b35bfb53bd889 /src | |
parent | 9909ff108e942ea0cd233d2cd3715f830c2ad89b (diff) |
QDockWidget - improve resize
On high DPI (e.g Apple Retina) user resizes of
QDockWidgets (with custom titlebars) could fail.
There was a cursor position check in mouse
move event bailing out if the cursor pos was not within
the widget.
The problem was that we could be on the edge
(or maybe even cross it?). Furthermore there is (/was)
no similar check when setting the cursor
to be a resize cursor, so users will obviously expect
the resize to occur.
This solves a part of QTBUG-63526
[ChangeLog][QtWidgets][QDockWidget] Fixed an issue
in QDockWidgets where the widget would not resize
despite showing a resize cursor.
Task-number: QTBUG-63526
Change-Id: Ifa842a109071552506da3a82822d903dc252c8cd
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qwidgetresizehandler.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index 5bd87ac91c..09c5e52219 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -118,7 +118,9 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee) QMouseEvent *e = static_cast<QMouseEvent *>(ee); if (w->isMaximized()) break; - if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos()))) + const QRect widgetRect = widget->rect().marginsAdded(QMargins(range, range, range, range)); + const QPoint cursorPoint = widget->mapFromGlobal(e->globalPos()); + if (!widgetRect.contains(cursorPoint) || mode == Center || mode == Nowhere) return false; if (e->button() == Qt::LeftButton) { #if 0 // Used to be included in Qt4 for Q_WS_X11 |