diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-06-11 13:35:22 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-14 04:31:45 (GMT) |
commit | 789cb3137fe86fc040d53b16b4736188362028cb (patch) | |
tree | 5624f47049053f2ac3cebdc6e8502c70ee7b6d70 /tests | |
parent | e813793940c961a7d831dca133512f61e8bf78f5 (diff) | |
download | Qt-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 'tests')
-rw-r--r-- | tests/auto/qdockwidget/tst_qdockwidget.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index 22f4f23..dff0ec0 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -363,7 +363,9 @@ void tst_QDockWidget::features() void tst_QDockWidget::setFloating() { + const QRect deskRect = QApplication::desktop()->availableGeometry(); QMainWindow mw; + mw.move(deskRect.left() + deskRect.width() * 2 / 3, deskRect.top() + deskRect.height() / 3); QDockWidget dw; mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); @@ -373,10 +375,16 @@ void tst_QDockWidget::setFloating() #endif QVERIFY(!dw.isFloating()); + const QPoint dockedPosition = dw.mapToGlobal(dw.pos()); QSignalSpy spy(&dw, SIGNAL(topLevelChanged(bool))); dw.setFloating(true); + const QPoint floatingPosition = dw.pos(); + + // QTBUG-31044, show approximately at old position, give or take window frame. + QVERIFY((dockedPosition - floatingPosition).manhattanLength() < 50); + QVERIFY(dw.isFloating()); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating()); |