main.cpp中添加
#include <QDesktopWidget>QDesktopWidget* desktop = QApplication::desktop(); w.move(desktop->screenGeometry().center() - w.rect().center()); w.show();