Save and restore last window position and size.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-23 12:47:16 +03:00
parent 5545eafb6e
commit 33a1454745
2 changed files with 4 additions and 3 deletions

View File

@ -175,7 +175,6 @@ int main(int argc, char *argv[])
} }
MainWindow w; MainWindow w;
w.setWindowState(w.windowState() ^ Qt::WindowMaximized);
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png")); app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
app.setMainWindow(&w); app.setMainWindow(&w);
TableWindow table; TableWindow table;

View File

@ -57,6 +57,7 @@
#include <QSettings> #include <QSettings>
#include <QTimer> #include <QTimer>
#include <QtGlobal> #include <QtGlobal>
#include <QDesktopWidget>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -1920,8 +1921,9 @@ QString MainWindow::strippedName(const QString &fullFileName)
*/ */
void MainWindow::ReadSettings() void MainWindow::ReadSettings()
{ {
QPoint pos = qApp->getSettings()->value("pos", QPoint(10, 10)).toPoint(); QRect geomentry = VApplication::desktop()->availableGeometry(this);
QSize size = qApp->getSettings()->value("size", QSize(1000, 800)).toSize(); QPoint pos = qApp->getSettings()->value("pos", geomentry.topLeft()).toPoint();
QSize size = qApp->getSettings()->value("size", geomentry.size()).toSize();
resize(size); resize(size);
move(pos); move(pos);