[Interest] [OS X] creating a QDialog from a WId?

René J. V. Bertin rjvbertin at gmail.com
Wed Dec 9 01:05:04 CET 2015


Nuno Santos wrote:


Hello Nunos,

Have you tried using a `ptr` that comes from another application? I think that's 
the context in which I get the crash.

I'll keep your code in mind though; the crash issue also reminded me that KF5 
KWindowSystem doesn't yet have a plugin (backed) implemented for OS X, so I'm 
porting the one from KDE4... Fun times!

R.

> Rene,
> 
> I have recently dealt with creating content within a native window on mac
> given a pointer. This was I got to:
> 
> QMacNativeWidget* IVstEditor::fromWindowRef(void *ptr)
> {
>     NSView* view = (NSView*) ptr;
> 
>     QMacNativeWidget *nativeWidget = new QMacNativeWidget(view);
> 
>     nativeWidget->move(0, 0);
>     nativeWidget->setPalette(QPalette(Qt::red));
>     nativeWidget->setAutoFillBackground(true);
>     nativeWidget->setWindowFlags(Qt::FramelessWindowHint |
>     Qt::WindowDoesNotAcceptFocus);
> 
>     NSView *nativeWidgetView = reinterpret_cast<NSView
>     *>(nativeWidget->winId());
> 
>     [view addSubview:nativeWidgetView];
> 
>     nativeWidget->show();
> 
>     return nativeWidget;
> }
> 
> I don’t know if you can turn a simple widget into a QDialog but maybe you can
> find something useful here.






More information about the Interest mailing list