19 #include <QApplication>
23 class QmitkCallbackEvent :
public QEvent
26 QmitkCallbackEvent(itk::Command *cmd, itk::EventObject *e) : QEvent(QEvent::User), m_Command(cmd), m_Event(e) {}
27 ~QmitkCallbackEvent() {
delete m_Event; }
28 itk::Command *command() {
return m_Command; }
29 itk::EventObject *itkevent() {
return m_Event; }
32 itk::EventObject *m_Event;
46 QApplication::instance()->postEvent(
this,
new QmitkCallbackEvent(cmd, e));
51 QmitkCallbackEvent *
event(dynamic_cast<QmitkCallbackEvent *>(e));
56 itk::Command *cmd(event->command());
60 if (event->itkevent())
62 cmd->Execute((
const itk::Object *)
nullptr,
63 *(event->itkevent()));
67 const itk::NoEvent dummyEvent;
68 cmd->Execute((
const itk::Object *)
nullptr,
itk::SmartPointer< Self > Pointer
QmitkCallbackFromGUIThread()
static void RegisterImplementation(CallbackFromGUIThreadImplementation *implementation)
To be called by a toolkit specific CallbackFromGUIThreadImplementation.
virtual void CallThisFromGUIThread(itk::Command *, itk::EventObject *) override
Change the current application cursor.
virtual bool event(QEvent *e) override
virtual ~QmitkCallbackFromGUIThread()