Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
restoreState() any way to remove layout data for named QWidgets?
caleb last edited by caleb
I am working on a project using QT 5.6 that makes use of various windows and dockwidgets and some of these widgets/windows can be opened via Lua script calls in our engine. When they are opened, the window layout is restored again to apply the layout data to any dockwidgets that may not have been opened at load time.
The normal behavior of restoreState is great but we have an edge case with this where if a user has changed the layout of their dockwidgets and then opens a new dockwidget their layout is reset to the previously saved version rather than taking their changes into account.
I would saveState() again but this would lose information about windows which are not yet open and have had a layout saved from previous sessions. What we need is a way to flag certain named dockwidgets as having been manually resized and to avoid setting the layout on those manually resized widgets when we call restoreState() again.
Is there a way I can make this happen?
Thank you in advance!
Hi and welcome to devnet,
Frome the looks of it you would need to either do a "pre-parsing" of the state and remove everything you don't want from it. Or re-implement restoreState to do what you want. Note that this is not virtual function so you will have your own version mimicking the original behaviour to some extent.
Hope it helps.