13 #ifndef QMITKSAFENOTIFY_H 14 #define QMITKSAFENOTIFY_H 19 #include <QMessageBox> 27 return app->A::notify(receiver, event);
31 msg = QString(
"MITK Exception:\n\n") + QString(
"Description: ") + QString(e.GetDescription()) + QString(
"\n\n") +
32 QString(
"Filename: ") + QString(e.GetFile()) + QString(
"\n\n") + QString(
"Line: ") +
33 QString::number(e.GetLine());
35 catch (std::exception &e)
41 msg =
"Unknown exception";
43 MITK_ERROR <<
"An error occurred: " << msg.toStdString();
46 msgBox.setText(
"An error occurred. You should save all data and quit the program to prevent possible data loss.");
47 msgBox.setDetailedText(msg);
48 msgBox.setIcon(QMessageBox::Critical);
49 msgBox.addButton(app->trUtf8(
"Exit immediately"), QMessageBox::YesRole);
50 msgBox.addButton(app->trUtf8(
"Ignore"), QMessageBox::NoRole);
52 int ret = msgBox.exec();
58 app->closeAllWindows();
62 <<
"The error was ignored by the user. The program may be in a corrupt state and don't behave like expected!";
69 #endif // QMITKSAFENOTIFY_H
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
bool QmitkSafeNotify(A *app, QObject *receiver, QEvent *event)