]> https://gitweb.dealii.org/ - parameter_gui.git/commitdiff
Store and restore window state 14/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 11 Apr 2017 22:33:25 +0000 (16:33 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 11 Apr 2017 22:33:25 +0000 (16:33 -0600)
mainwindow.cpp

index 0d70868689ed99b4e9902b333cd71d0df6397f1d..40b79e7650640983b52501b8fbde0ed62c010f04 100644 (file)
@@ -80,7 +80,10 @@ namespace dealii
       statusBar()->showMessage(tr("Ready, start editing by double-clicking or hitting F2!"));
       setWindowTitle(tr("[*]parameterGUI"));
 
-      showMaximized();
+      gui_settings->beginGroup("MainWindow");
+      resize(gui_settings->value("size", QSize(800, 600)).toSize());
+      move(gui_settings->value("pos", QPoint(0, 0)).toPoint());
+      gui_settings->endGroup();
 
       // if there is a file_name, try to load the file.
       // a valid file has the xml extension, so we require size() > 3
@@ -372,7 +375,14 @@ namespace dealii
       // First check, if we have to save modified content.
       // If not, or the content was saved, accept the event, otherwise ignore it
       if (maybe_save())
-        event->accept();
+        {
+          gui_settings->beginGroup("MainWindow");
+          gui_settings->setValue("size", size());
+          gui_settings->setValue("pos", pos());
+          gui_settings->endGroup();
+
+          event->accept();
+        }
       else
         event->ignore();
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.