PyQt4 - remember widget positions

Jeremy Sanders jeremy+complangpython at
Thu Oct 22 11:22:45 CEST 2009

nusch wrote:

> Is there any simple command which allows me to save position of all
> windows:  QMainWindow, QDialogs and qdockwidgets with their sizes,
> dock state and positions ? Or do I need to store those values
> manually, how can I do it fast?

You can use saveState() from QMainWindow to save the dockwidget geometries. 
I save the size and position of the main window separately and restore it 
with resize() and move().

You need to make sure all your toolbars and dockwidgets have unique object 
names for saveState to work.


Jeremy Sanders

More information about the Python-list mailing list