Please nominate your Qt Champions for 2021!

Quick Scene Graph render another QQuickItem

  • Hi.
    I need to make image component with custom geometry (polygon with changeable vertices).
    I made it in the next way. Created class PolygonImage that inherits QQuickItem. This class has properties for vertices and property 'source' of type QQuickItem. And in 'updatePaintNode' method I set the vertices to QSGGeometry geometry, and set texture of the image (source->textureProvider()->texture()) to QSGTextureMaterial material. And in qml I create component PolygonImage and component Image, set the image as source to the PolygonImage, and make the image not visible. And everything works fine, just as I need.
    But now I want to set as source of PolygonImage not simple Image, but image with some effect (some colorization shader). I set property 'layer.enabled' of the image to true, and 'layer.effect' to some shader. And like before set the image as source to the PolygonImage. And if make the image not visible, then the PolygonImage draws nothing. And if make the image visible, then PolygonImage draws what I need, but the image is also shown.
    Is it possible to make it as I need - to render some custom component in QQuickItem? Or maybe there is another way to implement it?
    P.S. I wanted to make it with Quick Scene Graph because AFAIK it would be the best for performance.

Log in to reply