Skip to content

Draft: [RFC] Impl. KisQuickWidgetCanvas to render QtQuick2 on canvas

This is a modification of KisOpenGLCanvas2 which uses QQuickRenderControl to render QtQuick2 scenes on canvas. The difference with this implementation and QQuickWidget is that, QQuickWidget uses a timer with 5ms timeout to delay sync and render, which causes the rendering of the QtQuick scene to be out of sync with QWidget updates, making the canvas noticeably slower, or even halving its update rate when vsync is in effect. This implementation instead syncs and renders directly onto the FBO of the QOpenGLWidget in sync with paintEvent / paintGL, successfully eliminating the issues with QQuickWidget.

Note that this does not implement forwarding input events to the offscreen QQuickWindow. This will be left for a later time.

This also adds two util classes, KisTopLevelWidgetChangeNotifier and KisWidgetScreenChangeNotifier, to be used to track the change of the associated screen of a widget. KisQuickWidgetCanvas then uses KisWidgetScreenChangeNotifier to detect these changes and update the screen of the offscreen QQuickWindow used for rendering QtQuick2 scenes.

This supersedes !1321 (closed).

When running with this patch, you can set the environment variable KIS_GLCANVAS to gl or quick switch between the old KisOpenGLCanvas2 and KisQuickWidgetCanvas. The default is quick gl.

Please review the 3rd commit and onward individually for the actual changes. The first two commits are just juggling to keep the git blame history. (Rebase needs to be done manually.)

Task ref:

Edited by Alvin Wong

Merge request reports