aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Mindalev <r000n@r000n.net>2013-03-21 00:05:50 +0400
committerRoman Mindalev <r000n@r000n.net>2013-03-23 08:21:42 +0400
commitf688056f9d4958b50911933496bf1fa2e602d396 (patch)
tree27d02c7a77b5c563c3ce78bf44249251686de89c
parente11f1806b6d722e2ae016bba053ac0c91616d800 (diff)
Show window in center of screen on first launch
-rw-r--r--src/qt/bitcoingui.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 89ce7d4a85..8bbea69018 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -55,6 +55,7 @@
#include <QMimeData>
#include <QStyle>
#include <QSettings>
+#include <QDesktopWidget>
#include <iostream>
@@ -480,6 +481,12 @@ void BitcoinGUI::restoreWindowGeometry()
QSettings settings;
QPoint pos = settings.value("nWindowPos").toPoint();
QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize();
+ if (!pos.x() && !pos.y())
+ {
+ QRect screen = qApp->desktop()->screenGeometry();
+ pos.setX((screen.width()-size.width())/2);
+ pos.setY((screen.height()-size.height())/2);
+ }
resize(size);
move(pos);
}