<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>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
(<a class="moz-txt-link-freetext" href="https://github.com/PyQt5/Examples/tree/master/PyQt5/opengl">https://github.com/PyQt5/Examples/tree/master/PyQt5/opengl</a>) but
it doesn't use QQuickRenderControl.<br>
</p>
<p>I tried with to follow more the c++ example: <br>
</p>
<pre>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
</pre>
<p>and later :</p>
<pre>self.m_renderControl = RenderControl(self)
self.m_quickWindow = QQuickWindow(self.m_renderControl)</pre>
<p>but still get :</p>
<pre> 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'</pre>
<p><br>
</p>
<p>I really don't know what I could change<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Le 06/01/2021 à 11:29, Phil Thompson a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:7f91d35f182c42f13facc966a679ef98@riverbankcomputing.com">On
06/01/2021 10:17, Jimmy Girardet wrote: <br>
<blockquote type="cite">Hi, happy new Year,
<br>
<br>
I was using QQuickRenderControl with pyside2 :
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/jgirardet/MyCartable/blob/dev/src/mycartable/conversion/grabber.py">https://github.com/jgirardet/MyCartable/blob/dev/src/mycartable/conversion/grabber.py</a>
<br>
<br>
<br>
I can't make it work with PyQt5. One problematic line is line 45
:
<br>
<br>
self.m_quickWindow = QQuickWindow(self.m_renderControl)
<br>
<br>
QQuickWindow with pyqt5 doesn"t accept QQuickREnderControl as
parent
<br>
(but it seems C++ does
<br>
<a class="moz-txt-link-freetext" href="https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/rendercontrol/window_singlethreaded.cpp?h=5.15#n119">https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/rendercontrol/window_singlethreaded.cpp?h=5.15#n119</a>)
<br>
</blockquote>
<br>
No it doesn't, you are misreading the C++ code. <br>
<br>
<blockquote type="cite">So how could I use QQuickRenderControl
with pyqt5, do you have an example ?
<br>
</blockquote>
<br>
Do what the C++ code is actually doing, not what you think it is
doing. <br>
<br>
<blockquote type="cite">More generally I just want to render some
QML offscreen and grab the
<br>
content. Do you have any other way to do it ?
<br>
</blockquote>
<br>
Phil <br>
</blockquote>
</body>
</html>