Reparenting MacOS app into QT based app so that other window behaves as child of QT window

302 Views Asked by At

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];
0

There are 0 best solutions below