From f688056f9d4958b50911933496bf1fa2e602d396 Mon Sep 17 00:00:00 2001 From: Roman Mindalev Date: Thu, 21 Mar 2013 00:05:50 +0400 Subject: [PATCH] Show window in center of screen on first launch --- src/qt/bitcoingui.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 89ce7d4a..8bbea690 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -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); }