10 #include "wvqthook.moc"
12 WvQtHook::WvQtHook(WvQtHookCallback _callback) :
18 void WvQtHook::setcallback(WvQtHookCallback _callback)
24 bool WvQtHook::event(QEvent *event)
28 QEvent::Type eventtype =
event->type();
29 if (eventtype < QEvent::User || eventtype > QEvent::MaxUser)
31 QCustomEvent *ce =
static_cast<QCustomEvent*
>(event);
32 callback(*
this, eventtype - QEvent::User, ce->data());
37 void WvQtHook::post(
int type,
void *data)
40 QEvent::Type eventtype = QEvent::Type(QEvent::User + type);
41 QCustomEvent *
event =
new QCustomEvent(eventtype, data);
42 QApplication::postEvent(
this, event);
46 void WvQtHook::send(
int type,
void *data)
48 QEvent::Type eventtype = QEvent::Type(QEvent::User + type);
49 QCustomEvent event(eventtype, data);
50 QApplication::sendEvent(
this, & event);