[Qt-interest] restoring state of nested dock widgets

Kishore kitts.mailinglists at gmail.com
Fri Jan 16 19:19:34 CET 2009


How can I save and restore size and position of a dock widget when nesting is 
enabled? The following code breaks for nested docks and they all end up 
appearing in the without the nesting.

Save the dock state in mainwindow's destructor:
        dockSettings.setValue("Size", dock->size());
        dockSettings.setValue("Position", dock->pos());
        dockSettings.setValue("Area", dockWidgetArea(dock));
        dockSettings.setValue("Floating", dock->isFloating());

Restore the dock state in mainwindow's constructor
        dock->setFloating(dockSettings.value("Floating", false).toBool());
        dock->setSource(aircraft);
        dock->setLocked(dockSettings.value("Locked", false).toBool());
        dock->resize(dockSettings.value("Size").toSize());
        dock->move(dockSettings.value("Position").toPoint());
        addDockWidget((Qt::DockWidgetArea)dockSettings.value("Area").toInt(), 
dock);

Since I can have multiple instances of a similar dockwidget, i cannot rely on 
restoreDockWidget() since i think it depends on the object name of the doc 
widget which I cannot easily maintain as unique.

So, how may i restore them to their correct state?
-- 
Cheers!
Kishore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090116/065ed149/attachment.bin 


More information about the Qt-interest-old mailing list