[Interest] [OS X] creating a QDialog from a WId?
Nuno Santos
nunosantos at imaginando.pt
Wed Dec 9 00:53:34 CET 2015
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.
Regards,
Nuno
> On 08/12/2015, at 16:14, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>
> Hello,
>
> I'm experiencing a crash in setMainWindow() with the code below (from KF5-kwidgetsaddons).
> Is this something that is allowed on OS X, and supposed to work?
>
> static QDialog *createWIdDialog(WId parent_id)
> {
> QWidget *parent = QWidget::find(parent_id);
> QDialog *dialog = new QDialog(parent, Qt::Dialog);
> if (!parent && parent_id) {
> setMainWindow(dialog, parent_id);
> }
> return dialog;
> }
>
> Thanks,
> R.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list