use QQuickRenderControl

Phil Thompson phil at riverbankcomputing.com
Wed Jan 6 14:37:58 GMT 2021


On 06/01/2021 13:42, Jimmy Girardet wrote:
> I can't C++ so I try to guess. There are python example for almost
> everything  so until nowI didn't have this problem. I also looked into
> the opengl examples
> (https://github.com/PyQt5/Examples/tree/master/PyQt5/opengl) but it
> doesn't use QQuickRenderControl.
> 
> I tried with to follow more the c++ example:
> 
> class RenderControl(QQuickRenderControl):
>     def __init__(self, w: QWindow):
>         super().__init__()
>         self.m_window = w
>     def renderWindow(self, offset: QPoint = None):
>         if (offset):
>             offset = QPoint(0, 0)
>         return self.m_window
> 
> and later :
> 
> self.m_renderControl = RenderControl(self)
> self.m_quickWindow = QQuickWindow(self.m_renderControl)
> 
> but still get :
> 
>   File "main.py", line 58, in __init__
>     self.m_quickWindow = QQuickWindow(self.m_renderControl)
> TypeError: QQuickWindow(parent: QWindow = None): argument 1 has
> unexpected type 'RenderControl'
> 
> 
> I really don't know what I could change

My apologies - it was me who was misreading the C++ code!

The C++ code is calling a ctor that is documented in the Qt source code 
as "internal", ie. it is not part of the public API. Therefore it isn't 
exposed by PyQt.

Phil


More information about the PyQt mailing list