summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-04-15 17:23:35 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-04-15 17:23:35 +0300
commite02dd2b8c525e48c4782a9ded7b38f5840bdd555 (patch)
tree4ceb090906079bd55be05cab4da22e2f758400b6 /src
parentAdd initial support for unread message count (diff)
downloadnheko-e02dd2b8c525e48c4782a9ded7b38f5840bdd555.tar.xz
Move the main window to the center
Diffstat (limited to 'src')
-rw-r--r--src/main.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc

index 9ef7ffd7..d7cb88b3 100644 --- a/src/main.cc +++ b/src/main.cc
@@ -16,6 +16,7 @@ */ #include <QApplication> +#include <QDesktopWidget> #include <QFontDatabase> #include "MainWindow.h" @@ -42,6 +43,13 @@ int main(int argc, char *argv[]) app.setFont(font); MainWindow w; + + // Move the MainWindow to the center + QRect screenGeometry = QApplication::desktop()->screenGeometry(); + int x = (screenGeometry.width() - w.width()) / 2; + int y = (screenGeometry.height() - w.height()) / 2; + + w.move(x, y); w.show(); return app.exec();