According to Digia Support, this is a bug. However, they provide an acceptable workaround.
Just before the QMessageBox::critical
we can add a ReleaseCapture();
like this:
#ifdef Q_OS_WIN
ReleaseCapture();
#endif
The behavior goes back to Qt 4.7 though (cf comment from user3183610). The window will snap back to its original size.