QQuickView embedded in NSView flickers like hell when being resized
-
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]