Can I save/restore the current state (pos/size...) of a QDockWidget?
Hi, I would like to save/restore the position, size and docking-window-state of a group of QDockWidgets in a QApplication.
The state of these QDockWidgets must not be saved in the global QSettings of the application, they must be saved in other project document (It is a XML-user document).
I see the methods to use for all windows of the application:
- void QApplication::saveState(QSessionManager & manager)
- void QApplication::restoreState(QSessionManager & manager)
But I dont know how to save or read the docking-window-state of each QDockWidget instance.
How do I do it?
Thanks in advance
Hi and welcome to devnet,
That's not the role of these two method.
As for the QDockWidget, each must have a unique object name. It's all explained in the documentation of these methods.
Hi, thanks for your reply, I dont want to save in the application QSettings file, but in a xml-node of another file, and only a group of QDockWidgets.
Is it possible?
I dont want to save in the application QSettings file, but in a xml-node of another file
You can do whatever you want with the returned QByteArray.
and only a group of QDockWidgets.
this is not possible.
For the group handling, you can try to restore the state of the QMainWindow before you create the QDockWidgets and then use restoreDockWidget on your group of interest.
Also be aware of QTBUG-16252.
Hi, thanks to all for your advices!
I will manage the "x/y/width/height" properties of the QDockWidgets and I will try to save and to restore the dock-state of each window "by hand".