Hi,

I’m embedding a QMacNativeWidget into another application plugin window.

Before embedding, the plugin window doesn’t do anything with the keyboard 
input, so, it flows down to the host, performing utility and important 
functions. As soon as I embed the QMacNativeWidget into into the plugin window, 
the keyboard is not received by the host anymore. I have been trying to read 
about widget and window flags and trying a lot of them without luck. Also, the 
window close button doesn’t work anymore.

Does anyone knows how can I prevent this behaviour? 

Below is the code I use to embed the QMacNativeWidget into the host plugin 
window:

QMacNativeWidget *nativeWidget = new QMacNativeWidget();

nativeWidget->setPalette(QPalette(Qt::red));
nativeWidget->setAutoFillBackground(true);
nativeWidget->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | 
Qt::WindowDoesNotAcceptFocus | Qt::WindowCloseButtonHint);
nativeWidget->clearFocus();
nativeWidget->releaseKeyboard();
nativeWidget->setAttribute(Qt::WA_ShowWithoutActivating);
nativeWidget->setAttribute(Qt::WA_NativeWindow);

NSView *nativeWidgetView = reinterpret_cast<NSView *>(nativeWidget->winId());

if ([view isKindOfClass:[NSView class]])
{
    [view addSubview:nativeWidgetView];
}
else
{
    #ifdef USE_CARBON_WINDOW
    HIRect frame;
    HIViewRef content;
    WindowRef w= (WindowRef) ptr;

    HIViewFindByID(HIViewGetRoot(w), kHIViewWindowContentID, &content);
    HIViewGetFrame(content, &frame);

    frame.origin.x=0;
    frame.origin.y=0;

    HICocoaViewCreate(0, 0, &hiCocoaView);
    HIViewSetFrame(hiCocoaView, &frame);
    HIViewAddSubview(content, hiCocoaView);
    HICocoaViewSetView(hiCocoaView, nativeWidgetView);
    #endif
}

nativeWidget->show(); 

Nuno

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to