From 12977cd35c22bd9f533fd8c71bcdc5398695b01a Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Tue, 11 Apr 2017 16:33:25 -0600 Subject: [PATCH] Store and restore window state --- mainwindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0d70868..40b79e7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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(); } -- 2.39.5