Help!! How to use the QRenderCaptureReply class (but in Python)
-
Re: Help!! How to use the QRenderCaptureReply class
I'm having a similar problem, but with a Qt3DWindow in PySide6. I've tried creating the QRenderCapture object with the Qt3DWindow's camera() as its argument, and with the Qt3DWindow.defaultFrameGraph.camera() as well. Seems no matter what I try, the 'completed' signal is never triggered.
self.extrude_window = Qt3DWindow()
self.window_container = createWindowContainer(self.extrude_window)
// Make a PNG file with the contents of the Qt3DWindow
self.renderCapture = Qt3DRender.QRenderCapture(self.extrude_window.camera())
reply = self.renderCapture.requestCapture()
// connect 'completed' signal to _save_png
reply.completed.connect(lambda: self._save_png(file_name, reply))
// but _save_png never gets called
def _save_png(self, file_name: str, reply):
reply.saveImage(file_name)
reply.deleteLater() -
@DeadComposer said in Help!! How to use the QRenderCaptureReply class (but in Python):
reply = self.renderCapture.requestCapture()
What is the scope/lifetime of this
reply
variable? If it is local to a function in Python it will be released when that exits, and may not give enough time forreply.completed
signal to be emitted. -
@DeadComposer
The documentation tells you it is your responsibility to delete the reply afterfinished
has been received, per the code in your slot. The code looks right to me in C++ (where it. Python, however, does its own deletion of objects which (it judges) go out of scope. I believe it will do that on thereply
object with the code you show at the end of whatever function it is inside.Try making
reply
beself.reply
, and see if you then hit the slot.