Qt5:窗口居中显示

QDesktopWidget* desktop = QApplication::desktop(); // =qApp->desktop();也可以
move((desktop->width() - this->width())/2, (desktop->height() - this->height())/2);

原文地址:https://www.cnblogs.com/wowk/p/3177041.html