summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockwidget.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
commit71264bae08d81bdeceb96133fdb01c370504dfcc (patch)
treed5dadaac8209d5ef1857a4d65197b9ee12b39848 /src/widgets/widgets/qdockwidget.cpp
parent5e785c0b83c9908c665f253c131629ac325a21f5 (diff)
parent6d10f739cd750968d0dd0e9d8fa4b64353a86c6c (diff)
Merge remote-tracking branch 'origin/5.9' into dev
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 28b97b2107..2928d51d20 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1021,6 +1021,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
*/
@@ -1537,6 +1543,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;