Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
(Re-)store MainWindow - separatly QToolBar and QDockWidget
suwide last edited by
i have a problem with (re-)storing certain view-sets in my application. We have different view-sets and a certain view-set has itself "sub-view-sets" again.
The sub-view-sets itself contains certain QDockWidgets which are depended on the sub-view-set and the user can toggle the visibility and change the position, which needs to be restored whenever the user switches back to this sub-view-set. The problem lies in the ToolBarArea which should not be sub-view-set depended which means i can't really (re-)store sub-view-set depended using the QMainWindow::restoreStates/saveStates functionallity.
I am wondering if there is any possibility to separatly re-/store Toolbars or Dockwidgets for that matter since i want to use the saveState()/restoreState() function from the MainWindow. Or is there a intelligent workaround ? I know sub-view-sets may not be the state of the "GUI-art" but we need the Dock feature within the sub-view-sets.
Also thought about using a separate MainWindow within the MainWindow for the view-set with sub-view-set but want to avoid this, since it has a "hacky" feel and since some DockWidgets are used view-set wide this may require some sort of management setting the correct parent and placing them into the respective MainWindow.
Further the approach to manually restore the positions and visibility had some weird side effects where its not always restored as expected, e.g. stacked dock widgets would toggle or splitters weren't 100% there where they were before.
Thanks in advance for any advice, ideas or even solutions,