I usually use a slot fatalError(const QString&) in program's Main Window and connect this with children's signal fatalError(const QString&).
The code of MainWindow::fatalError can be:
void MainWindow::fatalError(const QString& _details)
{
tr("Fatal Error"),
tr("%1 has encountered an error and cannot continue to work.\n"
"Please press OK button to quit.").arg(qApp->applicationName()),
this);
mbox.setDetailedText(_details);
mbox.exec();
qApp->quit();
}
void MainWindow::fatalError(const QString& _details)
{
QMessageBox mbox(
QMessageBox::Critical,
tr("Fatal Error"),
tr("%1 has encountered an error and cannot continue to work.\n"
"Please press OK button to quit.").arg(qApp->applicationName()),
QMessageBox::Ok,
this);
mbox.setDetailedText(_details);
mbox.exec();
qApp->quit();
}
To copy to clipboard, switch view to plain text mode
Bookmarks