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
This commit is contained in:
Sergio Martins
2021-04-29 21:36:56 +01:00
parent d5b2336b69
commit affb48f44d
2 changed files with 2 additions and 2 deletions

View File

@@ -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";

View File

@@ -6952,7 +6952,7 @@ void TestDocks::tst_deleteOnClose()
QVERIFY(Testing::waitForDeleted(dock1));
QVERIFY(!dock1.data());
//saver.restoreLayout(saved);
saver.restoreLayout(saved);
}
#endif
}