PDA

View Full Version : QMacCocoaViewContainer - How to receive QEvents from contained NSView?



AaronMK
23rd May 2010, 19:37
I have an QMacCocoaViewContainer subclass (let's call it QMacWidget) that I am using to bring an NSView subclass (let's call it NSViewWidget) into my Qt application. While the NSViewWidget appears correctly in my GUI hierarchy, I would like to be able to handle the events it receives in QMacWidget through mousePressEvent(), mouseMoveEvent(), etc.

I have found that I can do this piecemeal by putting handlers in NSViewWidget as I would in a Cocoa only app, translating, then manually calling the Qt event of the parent QMacWidget. However, this is error prone, and I'm wodering if Qt provides automated ways to do this. Overriding macEvent() to return false in QMacWidget looked like it had promise, but this function is never even called.

Thanks for any assistance.