Reputation: 4499
I have the following slot:
void MainWindow::showCriticalMessage(const QString& title, const QString& message)
{
QMessageBox msgBox(this);
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(title);
msgBox.setInformativeText(message);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
Will this be a potential problem if this slot is triggered multiple times before the user close the last pop out message box? Since I see many people say, use .show() instead of .exec().
Upvotes: 1
Views: 1260
Reputation: 9196
You will get a stack of dialogs which seems to be what you intend.
However you also will get nested exec() calls... one per dialog. This is pretty nasty but it will not do much harm by its own. However the potential damage heavily depends from the rest of your application (see the link I posted in the comment).
Upvotes: 3