use QQuickRenderControl

Phil Thompson phil at riverbankcomputing.com
Wed Jan 6 10:29:54 GMT 2021


On 06/01/2021 10:17, Jimmy Girardet wrote:
> Hi, happy new Year,
> 
> I was using QQuickRenderControl with pyside2 :
> 
> https://github.com/jgirardet/MyCartable/blob/dev/src/mycartable/conversion/grabber.py
> 
> 
> I can't make it work with PyQt5. One problematic line is line 45 :
> 
> self.m_quickWindow = QQuickWindow(self.m_renderControl)
> 
> QQuickWindow with pyqt5 doesn"t accept QQuickREnderControl as parent
> (but it seems C++ does
> https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/rendercontrol/window_singlethreaded.cpp?h=5.15#n119)

No it doesn't, you are misreading the C++ code.

> So how could I use QQuickRenderControl with pyqt5, do you have an 
> example ?

Do what the C++ code is actually doing, not what you think it is doing.

> More generally I just want to render some QML offscreen and grab the
> content. Do you have any other way to do it ?

Phil


More information about the PyQt mailing list