It gets worse. I experimented, and it seems that after a call to QFileDialog::getOpenFileName(), many (built-in) dialogs are somehow broken. I confirmed this for QMessageBox and QErrorMessage. Go ahead and change the code in doMain() to this:
@
void CMain::doMain() {
// check that the message box is working as expected!
QMessageBox::information(nullptr, "Test Msgbox", tr("Qt Version: %1").arg(QT_VERSION_STR));
// THIS QFILEDIALOG BREAKS SOMETHING!
// comment the next line out to see everything working normal!
QFileDialog::getOpenFileName(nullptr, "Open some file", QString(), tr("All files (.)"), nullptr, QFileDialog::ReadOnly);
// you'll hear the message box sound, but don't see anything
QMessageBox::warning(nullptr, "Test Msgbox 2", "Hi, I'm another msg box");
// the error msg will show up, but it will stay "unusable" in the background
// also the program will execute the following file dialog at the same time without waiting
QErrorMessage ErrMsg;
ErrMsg.setModal(true);
ErrMsg.showMessage(tr("This is some sort of error message"));
ErrMsg.exec();
// this pops up too early
QFileDialog::getOpenFileName(nullptr, "Open another file", QString(), tr("All files (.)"), nullptr, QFileDialog::ReadOnly);
cout << "doMain() done. Time to quit()." << endl;
qApp->quit();
}//end method
@
Comment out the first QFileDialog::getOpenFileName() where the comment suggest it. You'll see the expected behaviour. Now, enable that line, and watch every dialog (except another file dialog) "break" after that line. I've tested this on 2 different machines, both VS 2008, Qt 4.7.1, one Windows 7 32bit, the other WinXP SP3 32bit.