Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Embedding window inside Illustrator panel does not load 3D model on Mac
Forum Update on Monday, May 27th 2025

Embedding window inside Illustrator panel does not load 3D model on Mac

Scheduled Pinned Locked Moved General and Desktop
qmainwindowqwindowembedqmacnativewidge
3 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Poorti
    wrote on 14 Dec 2016, 12:27 last edited by
    #1

    Hi All,

    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,

    AIPanel(window)

    QMainWindow

    QWindow

    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.

    Please help.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 14 Dec 2016, 13:56 last edited by mrjj
      #2

      Hi
      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
      SetParent((HWND)mainWindow->winId(), panelWindow);

      Sorry if completely off. Never programmed for Macintosh.

      P 1 Reply Last reply 15 Dec 2016, 08:19
      0
      • M mrjj
        14 Dec 2016, 13:56

        Hi
        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
        SetParent((HWND)mainWindow->winId(), panelWindow);

        Sorry if completely off. Never programmed for Macintosh.

        P Offline
        P Offline
        Poorti
        wrote on 15 Dec 2016, 08:19 last edited by Poorti
        #3

        @mrjj
        Thanks for the reply!
        I followed your advice and tried setting the panelWindow as the parent...
        No change..

        Any other ideas?
        I followed this link,
        http://doc.qt.io/qt-5/qmacnativewidget.html#details

        1 Reply Last reply
        0

        1/3

        14 Dec 2016, 12:27

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved