summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockwidget.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-02-24 19:57:17 +0100
committerLiang Qi <liang.qi@qt.io>2017-02-24 20:01:42 +0100
commitde49839df8abfba1f3ed3c36ef3177e4a9d6ef00 (patch)
tree71e777ca1e33c58edd9149821e970495ef4b75b2 /src/widgets/widgets/qdockwidget.cpp
parente6234535929c67e7fbfa1ad7ce88f37df0b68d45 (diff)
parent4d3781b640e8fb0a04e96b2d05199247556b8d86 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts: mkspecs/features/moc.prf Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
Diffstat (limited to 'src/widgets/widgets/qdockwidget.cpp')
-rw-r--r--src/widgets/widgets/qdockwidget.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index aa5d809431..307a261a43 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1026,6 +1026,12 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
}
}
+void QDockWidgetPrivate::recalculatePressPos(QResizeEvent *event)
+{
+ qreal ratio = event->oldSize().width() / (1.0 * event->size().width());
+ state->pressPos.setX(state->pressPos.x() / ratio);
+}
+
/*! \internal
Called when the QDockWidget or the QDockWidgetGroupWindow is moved
*/
@@ -1542,6 +1548,13 @@ bool QDockWidget::event(QEvent *event)
// if the mainwindow is plugging us, we don't want to update undocked geometry
if (isFloating() && layout != 0 && layout->pluggingWidget != this)
d->undockedGeometry = geometry();
+
+ // Usually the window won't get resized while it's being moved, but it can happen,
+ // for example on Windows when moving to a screen with bigger scale factor
+ // (and Qt::AA_EnableHighDpiScaling is enabled). If that happens we should
+ // update state->pressPos, otherwise it will be outside the window when the window shrinks.
+ if (d->state && d->state->dragging)
+ d->recalculatePressPos(static_cast<QResizeEvent*>(event));
break;
default:
break;