Nominate our 2022 Qt Champions!

[Solved]Render a QML scene into a texture and save it

  • How could I translate the QML scene(like Rectangle, Image etc) into a texture and save it?
    Anyone tried this before?If I can translate the components to texture, then I should be able to save
    the image after processing by particle systems or shaderEffects

  • Looks like shaderEffectSource could render the qml scene to texture, but it do not provide a way for us to access the texture or save it, do anyone know where are the plug in source codes of the shaderEffectSource?

  • Example:


    height: 480

    ToTexture{ id: toTexture} //a new type created by c++


     anchors.fill: parent
     onClicked: {         


    The problem is, how could I design a new type like "ToTexture"? The example of " Scene Graph - OpenGL Under QML." show us how to render a qml scene, but I can't find an example show us how to transfer the qml scene to a texture.

    Without this function, I can't save the graph generated QtQuick

  • I found the other example

    "take screenshot":

    Take the screenshot by QQuickView, then do what we want

Log in to reply