I’m inserting a hook in the MFC message loop so that the Qt events are treated, without running ->exec() on qApp (because it’s blocking):
LRESULT CALLBACK myHookFn(int ncode, WPARAM wparam, LPARAM lparam) { if (qApp) qApp->sendPostedEvents(); return CallNextHookEx(0, ncode, wparam, lparam); }
and
int argc = 0; new QApplication(argc, NULL); SetWindowsHookEx(WH_GETMESSAGE, myHookFn, 0, threadId);
My question is:
What are the mechanisms equivalent to the MFC hook insertion that can be used under MacOSX so that sendPostedEvents could also be called?
This should happen automatically with Qt Mac 4.5 (both Carbon and Cocoa ports) – since Qt’s registered as a CFRunLoopSource in CFRunLoop and the callback will invoke sendPostedEvents. See also qeventdispatcher_mac.mm in src/gui/kernel of Qt 4.5