QWidget *t_newWidget = new QWidget(NULL);t_newWidget->resize(300,400);t_newWidget->show();NSView * view = (NSView *) t_newWidget->winId();NSWindow * nsWin = [view window];SDL_Init(SDL_INIT_VIDEO);SDL_Window* window = SDL_CreateWindowFrom((void*)nsWin);//SDL_CreateWindow("test windows", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,500, 200,SDL_WINDOW_SHOWN);;//SDL_CreateWindowFrom((void*)t_newWidget->winId());SDL_Renderer* render = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);SDL_SetRenderDrawColor(render, 255, 0, 0, 255);SDL_RenderFillRect(render, NULL);SDL_RenderPResent(render);pro中添加:LIBS += -framework Foundation.mm中添加:#import <cocoa/cocoa.h>记得文件后缀要由:.cpp 改为 .mm
新闻热点
疑难解答