|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
A QApplication subclass that optionally catches unhandled exceptions in the Qt event loop. More...
#include <QmitkSafeApplication.h>


Public Member Functions | |
| QmitkSafeApplication (int &argc, char **argv, bool safeMode=true) | |
| Construct a QmitkSafeApplication. More... | |
| bool | notify (QObject *receiver, QEvent *event) override |
| Reimplements QApplication::notify() to catch unhandled exceptions. More... | |
| void | setSafeMode (bool safeMode) |
| Enable or disable safe mode. More... | |
| bool | getSafeMode () const |
| Query whether safe mode is currently enabled. More... | |
A QApplication subclass that optionally catches unhandled exceptions in the Qt event loop.
When safe mode is enabled, this class reimplements QApplication::notify() to wrap all event dispatching in a try/catch block. If an unhandled exception is thrown during event processing, it is caught and an error message is displayed to the user rather than crashing the application. When safe mode is disabled, standard QApplication::notify() behavior is used.
Definition at line 32 of file QmitkSafeApplication.h.
| QmitkSafeApplication::QmitkSafeApplication | ( | int & | argc, |
| char ** | argv, | ||
| bool | safeMode = true |
||
| ) |
Construct a QmitkSafeApplication.
| [in,out] | argc | Reference to the application argument count (passed to QApplication). |
| [in] | argv | Array of command line argument strings (passed to QApplication). |
| [in] | safeMode | If true, exception-safe event dispatching is enabled. Defaults to true. |
| bool QmitkSafeApplication::getSafeMode | ( | ) | const |
Query whether safe mode is currently enabled.
true if safe mode is enabled; false otherwise.
|
override |
Reimplements QApplication::notify() to catch unhandled exceptions.
When safe mode is enabled, exceptions thrown during event processing are caught and an error message dialog is displayed. When safe mode is disabled, this method delegates directly to QApplication::notify().
| [in] | receiver | The target QObject that should receive the event. |
| [in] | event | The QEvent to be delivered to the receiver. |
true if the event was recognized and processed by the receiver; false otherwise. | void QmitkSafeApplication::setSafeMode | ( | bool | safeMode | ) |
Enable or disable safe mode.
| [in] | safeMode | If true, exception-catching event dispatching is enabled. |