mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Move the main window to the center
This commit is contained in:
parent
3b0ff1a4cd
commit
e02dd2b8c5
2 changed files with 9 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
build
|
build
|
||||||
tags
|
tags
|
||||||
|
.clang_complete
|
||||||
|
|
||||||
# C++ objects and libs
|
# C++ objects and libs
|
||||||
|
|
||||||
|
@ -44,4 +45,3 @@ CMakeCache.txt
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
@ -42,6 +43,13 @@ int main(int argc, char *argv[])
|
||||||
app.setFont(font);
|
app.setFont(font);
|
||||||
|
|
||||||
MainWindow w;
|
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();
|
w.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
Loading…
Reference in a new issue