How to center a window on the screen
#include <QStyle> #include <QDesktopWidget> window->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, window->size(), qApp->desktop()->availableGeometry() ));
#include <QStyle> #include <QDesktopWidget> window->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, window->size(), qApp->desktop()->availableGeometry() ));