I am trying to create a HUD that is an NSPanel in Qt. I am using QMacCocoaViewContainer as suggested in the qt documentation.
In HUD.h
#import <QWidget>
#import <QMacCocoaViewContainer>
class HUD : public QMacCocoaViewContainer
{
public:
HUD(QWidget* parent);
};
In HUD.mm
#import "HUD.h"
#import <Cocoa/Cocoa.h>
HUD::HUD(QWidget* parent) : QMacCocoaViewContainer(0,parent)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSPanel *panel = [[NSPanel alloc] initWithContentRect: NSRectFromCGRect(CGRectMake(0,0,250,250))
styleMask:NSHUDWindowMask | NSTitledWindowMask | NSUtilityWindowMask
backing:NSBackingStoreBuffered
defer:YES
screen:[[NSApp mainWindow] screen]];
setCocoaView(panel);
[panel release];
[pool release];
}
Every time I run it however I get an error saying [NSPanel window]: unrecognized selector sent to instance 0x21231f0. Has anybody had any luck mixing Qt and Cocoa? Any tricks that you used to make it work?