Skip to content
Snippets Groups Projects
Commit e02dd2b8 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Move the main window to the center

parent 3b0ff1a4
No related branches found
No related tags found
No related merge requests found
build
tags
.clang_complete
# C++ objects and libs
......@@ -44,4 +45,3 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment