I have a Qt application that load .dlls which in turn will add QDockwidget
widgets to a QMainWindow
. To maintain the size and geometry I am saving them in QMainWindow
QSettings settings;
settings.setValue("MainWindow/geometry", saveGeometry());
settings.setValue("MainWindow/windowState", saveState());
and on startup I read back the settings
QSettings settings;
restoreState(settings.value("MainWindow/windowState").toByteArray());
restoreGeometry(settings.value("MainWindow/geometry").toByteArray());
Just before calling show()
.
When I run the app, close it, then delete one of the dlls (effectively removing a QDockwidget
that previously loaded at start up), the app will freeze on the show()
call in QMainWindow
. I can get the application to start up properly by deleting the registry folder (I'm in Windows) HKEY_CURRENT_USER\Software\MyCompany\MyApplication\MainWindow
, but I lose all the other information stored there.
What I want is for the UI to come up as if the missing QDockWidget
is hidden and can never be restored, not this nonsense of destroying all of the geometry and state information.
Has anyone seen this problem? Solved it even!?! I would be grateful for any hints, tips, or work-arounds!
Cheers