summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-06-11 13:35:22 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-14 04:31:45 (GMT)
commit789cb3137fe86fc040d53b16b4736188362028cb (patch)
tree5624f47049053f2ac3cebdc6e8502c70ee7b6d70 /src
parente813793940c961a7d831dca133512f61e8bf78f5 (diff)
downloadQt-789cb3137fe86fc040d53b16b4736188362028cb.zip
Qt-789cb3137fe86fc040d53b16b4736188362028cb.tar.gz
Qt-789cb3137fe86fc040d53b16b4736188362028cb.tar.bz2
QDockWidget: Keep position when undocking.
Initialize undockedGeometry to roughly the current position. Task-number: QTBUG-31044 Change-Id: I03cbe280d1215bb58ab721b60e29b45359cde76d Reviewed-by: Andy Shaw <andy.shaw@digia.com> (cherry picked from qtbase/0d459619a902e547d8c74745453b3bdb8f67a660)
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qdockwidget.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 1ba3e9a..bb585b1 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1281,6 +1281,9 @@ void QDockWidget::setFloating(bool floating)
d->endDrag(true);
QRect r = d->undockedGeometry;
+ // Keep position when undocking for the first time.
+ if (floating && isVisible() && !r.isValid())
+ r = QRect(mapToGlobal(QPoint(0, 0)), size());
d->setWindowState(floating, false, floating ? r : QRect());