[Qt-interest] Save and restore custom DockWidgets
Tobias Rausch
rausch.tobias at gmail.com
Tue Mar 2 13:35:32 CET 2010
Hello,
I am trying to save and restore position and size of my own DockWidgets.
I have more than one custom Classes inherited from QDockWidget which are
added to QMainWindow with an unique ObjectName.
On the close event, I save the geometry of my MainWindow and the state with
these functions:
settings->setValue("mainwindow/geometry", this->saveGeometry());
settings->setValue("mainwindow/state", this->saveState());
These Settings are restored on startup in my function readSettings() called
in the constructor of MainWindow:
void MainWindow::readSettings()
{
//Restore states
this->restoreGeometry(settings->getValue("mainwindow/geometry").toByteArray());
this->restoreState(settings->getValue("mainwindow/state").toByteArray());
//Restore Widgets
QList<QDockWidget*> temp = this->findChildren<QDockWidget*>();
for (int i = 0; i < temp.size(); i++)
qDebug() << temp.at(i)->objectName();
}
The geometry of MainWindow is restored correctly.
My Toolbar is located at the same position as before and the size is
correct.
The problem is, that no DockWidgets are loaded (I don't even know if they
have been saved ..) and the children list is empty..
I was unable to find any example showing how to save/load custom
DockWidgets, so I am asking here.
Thanks and Best Regards,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100302/7c67e4f7/attachment.html
More information about the Qt-interest-old
mailing list