Important: Please read the Qt Code of Conduct -

Get QML Item texture in QQuickFramebufferObject

  • Hello,

    I have a QML item made from a QQuickFramebufferObject and I want to create another QQuickFramebufferObject that receives this QML item and applies some fancy post-processing effects. I know it's easy to apply effects with QML but I need to do it in C++ with custom OpenGL code.

    So far what I do is:

    class MyEffect: public QQuickFramebufferObject
        Q_PROPERTY(QQuickItem* srcItem MEMBER m_ptSrcItem NOTIFY srcItemChanged)


    MyEffect {
        id: effect
        anchors.fill: parent
        srcItem: ShaderEffectSource {
            sourceItem: myCustomItem
            hideSource: true

    The problem is that when I try to receive the texture from the Item, I get this error "QQuickImage::textureProvider: can only be queried on the rendering thread of an exposed window". I've been looking in the ShaderEffect source code and they seem to use QQuickItemPrivate to assign a window but I don't have access to that class.

    Any thoughts?


Log in to reply