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>
bb10
Thorbjørn Lund Martsum 2017-10-09 14:08:23 +02:00
parent 9909ff108e
commit f1033567aa
1 changed files with 3 additions and 1 deletions

View File

@ -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