Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkSafeNotify.h File Reference
#include <mitkException.h>
#include <mitkLog.h>
#include <QMessageBox>
#include <cstdlib>

Go to the source code of this file.

Functions

template<class A >
bool QmitkSafeNotify (A *app, QObject *receiver, QEvent *event)
 Safely delivers a Qt event, catching and displaying any exceptions. More...
 

Function Documentation

◆ QmitkSafeNotify()

template<class A >
bool QmitkSafeNotify ( A *  app,
QObject *  receiver,
QEvent *  event 
)

Safely delivers a Qt event, catching and displaying any exceptions.

Wraps a call to QApplication::notify() in a try/catch block. If an exception is thrown during event delivery, a critical QMessageBox is shown to the user with the option to exit the application or ignore the error.

Template Parameters
AA QApplication-derived type whose notify() method is to be called.
Parameters
appPointer to the application instance.
receiverThe QObject that should receive the event.
eventThe QEvent to deliver.
Returns
true if the event was handled successfully, false if an exception occurred.

Definition at line 38 of file QmitkSafeNotify.h.

References MITK_ERROR.