Qt World Summit: Submit your Presentation

NSView in QWidget

  • Hi,
    I have an application which uses NSTextView. Since QT5 doesnt contain QMacCocoaViewContainer any more, i had to find an other way to set an NSView into a QWidget. This way works in most cases:

    NSView* parentNSView = reinterpret_cast<NSView*>(parent->winId());
    [parentNSView addSubview:(NSView*)nsTextView];

    The widget is being displayed correctly. But Qt debugs the message "QBackingStore::flush() called with non-exposed window, behavior is undefined", and there are some problems when the nstextview is part of a docking widget... so I think it is not the right solution. I also tried

    create(WId((NSView*)nsTextView), false, true);

    In the QWidget's constructor that contains the NSTextview, but then it is not visible.
    Any tips?
    Thanks a alot..

  • You can wait for Qt 5.1 (when this bug will be fixed). And if you cannot then keep using 4.8.x

Log in to reply