From 00b0f4ec318947559369a2e31d7dc52a8e8556d5 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 25 Oct 2014 15:50:48 +0300 Subject: [PATCH] Better way restoring a window's geometry. --HG-- branch : develop --- src/app/mainwindow.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 638f57f71..14ca5fe3a 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1942,11 +1942,8 @@ QString MainWindow::strippedName(const QString &fullFileName) */ void MainWindow::ReadSettings() { - QRect geomentry = VApplication::desktop()->availableGeometry(this); - QPoint pos = qApp->getSettings()->value("pos", geomentry.topLeft()).toPoint(); - QSize size = qApp->getSettings()->value("size", geomentry.size()).toSize(); - resize(size); - move(pos); + restoreGeometry(qApp->getSettings()->value("geometry").toByteArray()); + restoreState(qApp->getSettings()->value("windowState").toByteArray()); // Scene antialiasing bool graphOutputValue = qApp->getSettings()->value("pattern/graphicalOutput", 1).toBool(); @@ -1969,8 +1966,8 @@ void MainWindow::ReadSettings() */ void MainWindow::WriteSettings() { - qApp->getSettings()->setValue("pos", pos()); - qApp->getSettings()->setValue("size", size()); + qApp->getSettings()->setValue("geometry", saveGeometry()); + qApp->getSettings()->setValue("windowState", saveState()); } //---------------------------------------------------------------------------------------------------------------------