Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Embedding window inside Illustrator panel does not load 3D model on Mac
Poorti last edited by
I am developing an Illustrator plugin for Win and Mac.
Inside the plugin panel window, I show a Qt window that displays a 3D model.
I am able to get it working on windows.
Its like this,
Now, on Mac, things behave differently,
First, the QMainWindow title bar can be seen outside the frame of the AIPanel whereas the rest of the window is inside the panel window.
Second, I get no error, but the 3D model never shows up.
I use this to embed the window on Mac,
QMacNativeWidget *nativeWidget = new QMacNativeWidget(); nativeWidget->move(0, 0); nativeWidget->setPalette(QPalette(Qt::red)); nativeWidget->setAutoFillBackground(true); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(mainWindow); nativeWidget->setLayout(layout); NSView* nativeWidgetView = reinterpret_cast<NSView*>(nativeWidget->winId()); [panelWindow setFrame:[nativeWidgetView frame]]; [panelWindow addSubview:nativeWidgetView positioned:NSWindowAbove relativeTo:nil]; nativeWidget->show(); mainWindow->show();
And this on Win,
SetWindowLong((HWND)mainWindow->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); SetParent((HWND)mainWindow->winId(), panelWindow);
Can anyone guide me a bit here? I thought the code would be cross-platform.
Im 100% Mac ignorant so just guessing.
The native thing you create
QMacNativeWidget *nativeWidget = new QMacNativeWidget();
You set no owner. it seems. so on windows that would make it float. ( for QWidgets normally)
It can accept a parentView in the ctor
MacNativeWidget::QMacNativeWidget(NSView *parentView = Q_NULLPTR)
So Im wondering if something like that?
For the windows version, you do set parent
Sorry if completely off. Never programmed for Macintosh.
Poorti last edited by Poorti
Thanks for the reply!
I followed your advice and tried setting the panelWindow as the parent...
Any other ideas?
I followed this link,