From affb48f44d5260ca4ca7bc9a297ba3f7c39ba4c2 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Thu, 29 Apr 2021 21:36:56 +0100 Subject: [PATCH] Fix restoring side-bar widget when it was deleted previously We need to consult the user's widget factory, just as we do for other cases where the dock widget is missing --- src/MainWindowBase.cpp | 2 +- tests/tst_docks.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MainWindowBase.cpp b/src/MainWindowBase.cpp index 449aebdd..ccbc9d2b 100644 --- a/src/MainWindowBase.cpp +++ b/src/MainWindowBase.cpp @@ -667,7 +667,7 @@ bool MainWindowBase::deserialize(const LayoutSaver::MainWindow &mw) const QStringList dockWidgets = mw.dockWidgetsPerSideBar.value(loc); for (const QString &uniqueName : dockWidgets) { - DockWidgetBase *dw = DockRegistry::self()->dockByName(uniqueName); + DockWidgetBase *dw = DockRegistry::self()->dockByName(uniqueName, DockRegistry::DockByNameFlag::CreateIfNotFound); if (!dw) { qWarning() << Q_FUNC_INFO << "Could not find dock widget" << uniqueName << ". Won't restore it to sidebar"; diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index 095abadc..fee63ae3 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -6952,7 +6952,7 @@ void TestDocks::tst_deleteOnClose() QVERIFY(Testing::waitForDeleted(dock1)); QVERIFY(!dock1.data()); - //saver.restoreLayout(saved); + saver.restoreLayout(saved); } #endif }