0

What I am trying to achieve is. I have a QT application which is cross-platform and I have a native mac app(obj c) & windows app(C#).

First my QT app launches and then on some button click(action) the native app is started and displayed in Mac/Windows. Now on windows we have something called reparenting a window (https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setparent) using this we can make the native app child of the QT app and hence it works as its child.

Do we have something similar in MAC that I can utilize ? If we do then do you have a sample or something that I can refer to?

Things I know i can create a NSWindow and show the window but I am not trying it to that way.

    NSView *contentView  =self.window.contentView;
    CGRect cRect = contentView.frame;

    CGRect rect = CGRectMake(wRect.origin.x, wRect.origin.y, cRect.size.width, cRect.size.height);
    NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect
                                                         styleMask:NSWindowStyleMaskBorderless
                                                       backing:NSBackingStoreBuffered
                                                         defer:NO];
    overlayWindow.backgroundColor = [NSColor redColor];
    [overlayWindow setOpaque:NO];
    overlayWindow.alphaValue = 0.5f;

    [self.window addChildWindow:overlayWindow ordered:NSWindowAbove];
Amit Hooda
  • 2,133
  • 3
  • 23
  • 37
  • Not sure but I think you're looking for something like [`QWidget::createWindowContainer`](https://doc.qt.io/qt-5/qwidget.html#createWindowContainer). Although it does rely on there being some means by which you can fetch the window id of the native app. – G.M. May 22 '20 at 18:20
  • @G.M. yes fetching the window id is one of the issue. native cocoa app is just another binary which is completely in cocoa, so for the reparenting stuff that windows provides i can do this easily. I was thinking that some similar api exists for mac as well. – Amit Hooda May 22 '20 at 18:47

0 Answers0