Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69302

Allow inserting at runtime NSView visually below QNSView to draw under QtQuick's GLContext

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • QPA
    • None
    • macOS

    Description

      Motivation: allow more flexiable native Objective-C++ calls at runtime on macOS when using QCocoaWindow.

      Case example: to implement the macOS' translucent window effect on a NSWindowStyleMaskFullSizeContent, one needs to use an NSVisualEffectView. One may add an NSVisualEffectView as as a subview of the QNSView created by QNSWindow. However, when setting the NSWindowStyleMaskFulSizeContent flag, the GL graphic contents drawn by Qt would be covered by the NSVisualEffectView. This problem can only be solved if NSVisualEffectView can be set as a superview of the QNSView.

      To achieve this one can replace the NSWindow's view by an NSVisualEffectView at runtime, however, doing so break's QNSWindow's effect handling. Upon inspection, I found that it breaks because when getting the platfromWindow QNSWindow makes the assumption that [self.contentView] is the QNSView when which is no longer the case at runtime.

      To solve the problem I have two alternative proposals:

      1. Make QNSWindow assume that NSWindow::firstResponser is the QNSView. This way one can reassign the firstResponser at runtime to make the event handling work again. (This way feels a bit hacky though, one would be restricted to use the default QNSView as the firstResponser.)
      2. Alternatively, when setting GLContext in QNSView, make QNSView create a subview to render it's graphics in. This way one can just insert arbituary NSViews at runtime between the root view and the rendered view.

       

      Attachments

        Activity

          People

            sorvig Morten Sørvig
            ylilarry ylilarry
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: