Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Help!! How to use the QRenderCaptureReply class
Forum Updated to NodeBB v4.3 + New Features

Help!! How to use the QRenderCaptureReply class

Scheduled Pinned Locked Moved Unsolved C++ Gurus
3 Posts 2 Posters 492 Views 2 Watching
  • 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.
  • Q Offline
    Q Offline
    qingcheng
    wrote on last edited by
    #1

    Due to the need of the project, I want to take screenshots of 3Dwindow, but this is the first time for me to use class QRenderCaptureReply , and there is no similar example provided by the official, I would like to ask how to use QRenderCaptureReply, do you have any reference demo? Thrans~~

    raven-worxR 1 Reply Last reply
    0
    • Q qingcheng

      Due to the need of the project, I want to take screenshots of 3Dwindow, but this is the first time for me to use class QRenderCaptureReply , and there is no similar example provided by the official, I would like to ask how to use QRenderCaptureReply, do you have any reference demo? Thrans~~

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @qingcheng

      Qt3DRender::QRenderCapture*  capture = new Qt3DRender::QRenderCapture(myCamera);  // myCamera is of type Qt3DRender::QCamera*
      Qt3DRender::QRenderCaptureReply* reply = capture->requestCapture();
      QObject::connect(reply, &Qt3DRender::QRenderCaptureReply::completed, [&]() {
             reply->image().save("capture.png");
             reply->deleteLater();
      });
      

      untested though, but this should do

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        qingcheng
        wrote on last edited by
        #3

        Very thank you for your reply, I found that calls your procedure, the returned is an empty image, debugging and found no trigger Qt3DRender: : QRenderCaptureReply: : completed signals, I wonder if call time is too short and not enough rendering? In addition, I would like to ask that I found the demo written by others on the Internet, as follows:
        auto camSelector = this->defaultFrameGraph()->findChildQt3DRender::QCamera*();
        m_cap = new Qt3DRender::QRenderCapture(camSelector);
        connect(this, &Q3DShowWindow::signalGetImage,&{
        QEventLoop loop;
        auto reply = m_cap->requestCapture();
        qDebug()<<"wait for m_returnimage finish";
        connect(reply, &Qt3DRender::QRenderCaptureReply::completed, [&] {
        m_returnImage = reply->image();
        reply->deleteLater();
        loop.quit();
        });
        loop.exec();
        });
        I found that when the signalGetImage signal is triggered, the program has been debugging information qDebug () has been unable to enter, do you know why? And how do you change the program? Looking forward to your reply!!

        1 Reply Last reply
        0
        • D DeadComposer referenced this topic on

        • Login

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