-
将.cpp改为.mm
-
修改代码
#if __APPLE__ #include <unistd.h> #include <mach-o/dyld.h> #include <Cocoa/Cocoa.h> #endif void init_ui() { #if !__APPLE__ setWindowFlag(Qt::FramelessWindowHint); #else NSView* view = (NSView*)this->winId(); NSWindow* wndd = [view window]; wndd.titlebarAppearsTransparent = YES; wndd.titleVisibility = NSWindowTitleHidden; wndd.styleMask |= NSFullSizeContentViewWindowMask; [[wndd standardWindowButton : NSWindowZoomButton] setHidden:YES]; [[wndd standardWindowButton : NSWindowMiniaturizeButton] setHidden:YES]; [[wndd standardWindowButton : NSWindowCloseButton] setHidden:YES]; #endif // !__APPLE__ }