diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-10 17:01:27 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-10 17:01:27 (GMT) |
commit | ba5fea372219000050715ecfac8fba9a6fd1b638 (patch) | |
tree | 2e0d8e5b33f5f6446967c71d7f23bd73ce680673 | |
parent | 2321e8636d7436b70a8afcde16828f00c4b8590e (diff) | |
download | Qt-ba5fea372219000050715ecfac8fba9a6fd1b638.zip Qt-ba5fea372219000050715ecfac8fba9a6fd1b638.tar.gz Qt-ba5fea372219000050715ecfac8fba9a6fd1b638.tar.bz2 |
QDockWidget also emits dockLocationChanged when the state is restored
...on the main window.
Task-number: QTBUG-1304
Reviewed-by: ogoffart
-rw-r--r-- | src/gui/widgets/qdockarealayout.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qdockwidget/tst_qdockwidget.cpp | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 27e145f..953edab 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1841,7 +1841,6 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const } } -#ifdef Q_WS_MAC static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) { switch (pos) { @@ -1853,7 +1852,6 @@ static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) } return Qt::NoDockWidgetArea; } -#endif static QRect constrainedRect(QRect rect, const QRect &desktop) { @@ -1980,6 +1978,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> if (!testing) { widget->setFloating(false); widget->setVisible(flags & StateFlagVisible); + emit widget->dockLocationChanged(toDockWidgetArea(dockPos)); } } diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index e04ed18..c9a7f1c 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -614,6 +614,7 @@ void tst_QDockWidget::dockLocationChanged() QMainWindow mw; QDockWidget dw; + dw.setObjectName("dock1"); QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea))); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); @@ -638,6 +639,7 @@ void tst_QDockWidget::dockLocationChanged() QCOMPARE(spy.count(), 0); QDockWidget dw2; + dw2.setObjectName("dock2"); mw.addDockWidget(Qt::TopDockWidgetArea, &dw2); mw.tabifyDockWidget(&dw2, &dw); QCOMPARE(spy.count(), 1); @@ -659,6 +661,12 @@ void tst_QDockWidget::dockLocationChanged() QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); + + QByteArray ba = mw.saveState(); + mw.restoreState(ba); + QCOMPARE(spy.count(), 1); + QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), + Qt::TopDockWidgetArea); } void tst_QDockWidget::featuresChanged() |