Код: Выделить всё
QRect screenGeometry = QApplication::desktop()->screenGeometry();
int x = (screenGeometry.width() - w->width()) / 2;
int y = (screenGeometry.height() - w->height()) / 2;
w->move(x, y); // w is a QMainWindow pointer
[img]https:/ /i.sstatic.net/aMsIP.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/479 ... mainwindow