How to show a QMessageBox completely before the next function call
I want to use a QMessageBox to announce a short waiting interval to the user.
QMessageBox* box(new
QMessageBox(QMessageBox::Information,"Parser","Processing " + mFileName));
box->setStandardButtons(QMessageBox::NoButton);
box->setWindowModality(Qt::WindowModal);
box->show();
QApplication::processEvents();
parser.analyseFile(mFileName);
box->hide();
box->deleteLater();
QApplication::processEvents();
The function only takes few seconds. The box gets displayed but neither
the icon nor the text is shown in time before the function finishes. Why
does QApplication::processEvents(); not prevent the program from
continuation before the box is completely shown. Is it possible to achieve
the desired behaviour without resorting to threads.
No comments:
Post a Comment