forked from Lubuntu/welcome
Center the window on the screen.
This commit is contained in:
parent
3d1a75b901
commit
348df0114a
11
main.cpp
11
main.cpp
@ -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…
x
Reference in New Issue
Block a user