[PyQt] Subclass QQuickFramebufferObject::Renderer and QOpenGLFunctions?

Elvis Stansvik elvstone at gmail.com
Sun Nov 11 12:40:25 GMT 2018

Hi all,

How can I subclass both QQuickFramebufferObject::Renderer and
QOpenGLFunctions, as done by the ColorRenderer in the
tst_qquickframebufferobject.cpp autotest in Qt:


Snipped from above:

class ColorRenderer : public QQuickFramebufferObject::Renderer,
protected QOpenGLFunctions
    void render();
    void synchronize(QQuickFramebufferObject *item);
    QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);

    QSize textureSize;
    QColor color;
    bool msaa;

I tried to do something like this using the _QOpenGLFunctions_4_1_Core
class from PyQt, but ran into problems since the metaclass of
_QOpenGLFunctions_4_1_Core is module, and the meta class of
QQuickFramebufferObject::Renderer is sip.wrappertype, and there's no
way to declare a metatype inheriting them both that could be used,
since they are incompatible at the C level.

Is it simply not possible to create a
QQuickFramebufferObject::Renderer like this using PyQt?

Anyone know of another way to create a custom QQuickFramebufferObject from PyQt?


More information about the PyQt mailing list