Better way restoring a window's geometry.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-25 15:50:48 +03:00
parent 1731637b7b
commit 00b0f4ec31

View File

@ -1942,11 +1942,8 @@ QString MainWindow::strippedName(const QString &fullFileName)
*/ */
void MainWindow::ReadSettings() void MainWindow::ReadSettings()
{ {
QRect geomentry = VApplication::desktop()->availableGeometry(this); restoreGeometry(qApp->getSettings()->value("geometry").toByteArray());
QPoint pos = qApp->getSettings()->value("pos", geomentry.topLeft()).toPoint(); restoreState(qApp->getSettings()->value("windowState").toByteArray());
QSize size = qApp->getSettings()->value("size", geomentry.size()).toSize();
resize(size);
move(pos);
// Scene antialiasing // Scene antialiasing
bool graphOutputValue = qApp->getSettings()->value("pattern/graphicalOutput", 1).toBool(); bool graphOutputValue = qApp->getSettings()->value("pattern/graphicalOutput", 1).toBool();
@ -1969,8 +1966,8 @@ void MainWindow::ReadSettings()
*/ */
void MainWindow::WriteSettings() void MainWindow::WriteSettings()
{ {
qApp->getSettings()->setValue("pos", pos()); qApp->getSettings()->setValue("geometry", saveGeometry());
qApp->getSettings()->setValue("size", size()); qApp->getSettings()->setValue("windowState", saveState());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------