PDA

View Full Version : Making sure dialogs and messageboxes pop up at the center of the screen



kedar
3rd October 2012, 20:45
Hello,

In my application however a user might frequently switch between tabs while a process within the application goes on. After the process is over a messagebox displays the information however every time the mainwindow loses focus i.e the user is on another application the message box appears in the top-left corner of the screen.


I know people have asked how to center dialog boxes to the center of the screen. But is there a way to make the message box appear in the center of the screen always instead of the top left corner.


void displayMessage(const char *text, QMessageBox::Icon icon)
{
QMessageBox message;
message.setIcon(icon);
message.setText(text);
message.exec();
}


Thanks

Kedar

wysota
3rd October 2012, 20:48
Does it change anything if you use static methods of QMessageBox?