Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to render a QQuickItem offscreen on a QQuickRenderControl from a C++ function



  • I am using QQuickRenderControl to render some texture using an QOffscreenSurface. This is very much dependent on the Qt official example for
    QQuickRenderControl

    How can I offscreen render individual QQuickItems to this QQuickRenderControl.

    I have the QQmlApplicationEngine pointer & easily get a qml object in C++ function like so:

    QQuickItem * my_qml_item = QmlEnginePointer->rootObjects()[0]->findChild<QQuickItem*>("MyQMLItemObject");
    

    How can I render my_qml_item into my QQuickRenderControl from a C++ function?

    PS: I have the QOffscreenSurface set up to take care of the refresh etc. I just want to know how to render any QQuickItem on this QQuickRenderControl.


Log in to reply