[Interest] QMessageBox::critical VS custom: discrepancies

Christian Kandeler christian.kandeler at digia.com
Mon Oct 8 17:43:05 CEST 2012


On 10/08/12 16:18, Sensei wrote:
> Dear all,
>
> I am moving some old QMessageBox::critical (and functions alike) to a
> Mac-aware UI. This means, according to the documentation, using a more
> verbose code, with an informative text.
>
> However, the widths of the static version VS my custom are quite
> different. Even more, the location in which they appear is different. It
> seems that the custom is placed on the center of the screen, while the
> static on the center of the application window!
>
> This is the ubersimple code:
>
>
>           QMessageBox msg;

[ ... ]

 >           QMessageBox::critical(this, tr("Error"), tr("Cannot create the
 > project. Please try again on a different folder."));

In one case you give the message box a parent, in the other you do not.
     QMessageBox msg(this);
should take care of the screen location difference.


Christian



More information about the Interest mailing list