Mercurial > hg > octave-lyh
changeset 15348:450fedd44176
correctly restore the size of all dock-widgets when maximized
* main-window.cc: save/restore geometry of dock-widgets when writing/reading the settings
author | Torsten <ttl@justmail.de> |
---|---|
date | Mon, 10 Sep 2012 21:55:18 +0200 |
parents | 9ed4fc294f3f |
children | 90c2b2d777bf a9fd6821eedf |
files | libgui/src/main-window.cc |
diffstat | 1 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -435,8 +435,21 @@ // FIXME -- what should happen if settings is 0? + restoreState (settings->value ("MainWindow/windowState").toByteArray ()); + settings->beginGroup ("DockWidgets"); + // restoring the geometry of all widgets + foreach (QObject *obj, children ()) + { + QString name = obj->objectName (); + if (obj->isWidgetType () && ! name.isEmpty ()) + { + QWidget *widget = qobject_cast<QWidget *> (obj); + QVariant val = settings->value (name); + widget->restoreGeometry (val.toByteArray ()); + } + } + settings->endGroup(); restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ()); - restoreState (settings->value ("MainWindow/windowState").toByteArray ()); emit settings_changed (); } @@ -449,6 +462,19 @@ settings->setValue ("MainWindow/geometry", saveGeometry ()); settings->setValue ("MainWindow/windowState", saveState ()); + settings->beginGroup ("DockWidgets"); + // saving the geometry of all widgets + foreach (QObject *obj, children()) + { + QString name = obj->objectName (); + if (obj->isWidgetType () && ! name.isEmpty ()) + { + QWidget *widget = qobject_cast<QWidget *>(obj); + settings->setValue (name, widget->saveGeometry ()); + } + } + + settings->endGroup(); settings->sync (); }