What is the format of the data saved by QMainWindow::saveState()?
-
I have a bug in my app which comes down to two different window state files: one works while the other causes my app to crash. I'd like to be able to dump the contents of the two state files in human readable form so that I can compare them to see what's different. What is the format of the data saved by QMainWindowState()?
Thanks.
-
Doesn't it use "QSettings":http://qt-project.org/doc/qt-4.8/qsettings.html#details ? So it would depend on platform
Also may be worth mentioning: I just read you need to setObjectName for each toolbar and dockwidget for saveState to work (Qt 5). Perhaps you're not doing that in one of your instances?
-
Hi,
It's a custom binary format. You can examine the source code here to see how the byte stream is constructed: http://code.woboq.org/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp.html#_ZNK11QMainWindow9saveStateEi
The code browser is interactive. Click on the functions to jump to their definitions. (You will eventually find QToolBarAreaLayout::saveState() and QDockAreaLayout::saveState() which do the writing. These are internal classes, so they are undocumented)