I'm trying to get the positions and state of QDockWidgets saved/restored when the application is exited and relaunched. The flow in my main window is as follows:
restoreState(state.toByteArray());
// Dock widget gets created
restoreDockWidget(dockWidget);
This works great excepted for one thing: if dock widgets are closed when the application exits, they reappear into their last position the next time the application is run, while I'd expect them to have an initial hidden state. Is there something I missed about the usage of restoreDockWidget? Or should I handle the visible state of the dock widgets manually?
Update: Note that if I do as follows:
// Dock widget gets created
restoreState(state.toByteArray());
Then previously hidden widgets remain hidden. Unfortunately I cannot rely on this scheme as I have dock widgets that are created by plugins after the main window is restored.
Edit: seems to be fixed in latest Qt versions.