I want to create a program in Qt when running show window in center screen. We must include header QStyle and QDesktopWidget to show window in center screen. This is a simple method how to create a program in Qt when running show window in center of screen :
#include "runonlyone.h" //change with your include window application
int main(int argc, char *argv)
QApplication a(argc, argv);
runOnlyOne w; //change with your window application
Qt::AlignCenter, w.size(), qApp->desktop()->availableGeometry()));
You can change runOnlyOne with your window application. I am success to compile this Qt: Show Window In Center Screen program in Ubuntu with Qt 4.6.2.