Center the window on the screen.

master
Simon Quigley 6 years ago
parent 3d1a75b901
commit 348df0114a

@ -15,11 +15,22 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QStyle>
#include <QDesktopWidget>
#include <QScreen>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
MainWindow w; MainWindow w;
w.setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
w.size(),
QGuiApplication::screens().first()->geometry()
)
);
w.show(); w.show();
return app.exec(); return app.exec();

Loading…
Cancel
Save