Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickView embedded in NSView flickers like hell when being resized

QQuickView embedded in NSView flickers like hell when being resized

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    woolfman007
    wrote on last edited by
    #1

    Hi all, this one is a complicated one - at least for me, as I'm totally stuck.

    What I do is this: on the Mac I create a QQuickView from scratch and re-parent it to an existing NSView.
    There's (official) example code how to do this (see below).

    Then, every time I resize my QQuickView, it starts to flicker like hell.

    If I do the same thing within a simple QtCreator project I built from scratch (creating a QQuickView as
    my application window's child), I can resize it without any problems.

    Furthermore, it seems that the behaviour i noticed is special to the QQuickView class;
    if I do the same thing with a plain QWindow (re-parent it to my existing NSView),
    I can resize it properly without any artefacts (I painted a custom background to the
    QWindow, to see if resizing works)

    please help anybody, I can't quite figure out what to do.

    official reparenting code:

    @
    NSView *getEmbeddableView(QWindow *qtWindow)
    {
    // Get the Qt content NSView for the QWindow forom the Qt platform plugin
    QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface();

    // Inform the window that it's a subwindow of a non-Qt window. This must be
    // done after create() because we need to have a QPlatformWindow instance.
    // The corresponding NSWindow will not be shown and can be deleted later.
    typedef void (*SetEmbeddedInForeignViewFunction)(QPlatformWindow *window, bool embedded);
    reinterpret_cast<SetEmbeddedInForeignViewFunction>(platformNativeInterface->
                                                       nativeResourceFunctionForIntegration("setEmbeddedInForeignView"))(qtWindow->handle(), true);
    
    // Get the Qt content NSView for the QWindow from the Qt platform plugin
    NSView *qtView = (NSView *)platformNativeInterface->nativeResourceForWindow("nsview", qtWindow);
    return qtView; // qtView is ready for use.
    

    }

    ...
    QQuickView *qv = new QQUickView;
    ...
    NSView *nsv_qv = getEmbeddableView(qv);
    NSView *nsv_parent = ...
    [nsv_parent addSubView: nsv_qv]
    @

    [edit: added missing coding tags @ SGaist]

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved