Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Help!! How to use the QRenderCaptureReply class (but in Python)
Forum Updated to NodeBB v4.3 + New Features

Help!! How to use the QRenderCaptureReply class (but in Python)

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 318 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DeadComposer
    wrote on last edited by
    #1

    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()

    JonBJ 1 Reply Last reply
    0
    • D DeadComposer

      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()

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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 for reply.completed signal to be emitted.

      D 1 Reply Last reply
      1
      • JonBJ JonB

        @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 for reply.completed signal to be emitted.

        D Offline
        D Offline
        DeadComposer
        wrote on last edited by
        #3

        @JonB That makes sense, but why does the description of QRenderCaptureReply require that 'reply' be manually deleted with a "deleteLater" call if it will be released automatically when it goes out of scope?

        JonBJ 1 Reply Last reply
        0
        • D DeadComposer

          @JonB That makes sense, but why does the description of QRenderCaptureReply require that 'reply' be manually deleted with a "deleteLater" call if it will be released automatically when it goes out of scope?

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #4

          @DeadComposer
          The documentation tells you it is your responsibility to delete the reply after finished 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 the reply object with the code you show at the end of whatever function it is inside.

          Try making reply be self.reply, and see if you then hit the slot.

          D 1 Reply Last reply
          0
          • JonBJ JonB

            @DeadComposer
            The documentation tells you it is your responsibility to delete the reply after finished 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 the reply object with the code you show at the end of whatever function it is inside.

            Try making reply be self.reply, and see if you then hit the slot.

            D Offline
            D Offline
            DeadComposer
            wrote on last edited by
            #5

            @JonB Tried making it self.reply, and still the 'completed' signal is not triggered.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved