From 06164fde0c3f67982aa949de0550dae6eb73e0a5 Mon Sep 17 00:00:00 2001 From: Tony Date: Sun, 2 Jun 2019 21:06:03 +0800 Subject: [PATCH] move window to desktop center --- main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.cpp b/main.cpp index 51ba3d2..c0f7d22 100644 --- a/main.cpp +++ b/main.cpp @@ -24,5 +24,7 @@ int main(int argc, char *argv[]) file.close(); MainWindow w; w.show(); + w.move((QApplication::desktop()->width() - w.width()) / 2, + (QApplication::desktop()->height() - w.height()) / 2); return a.exec(); }