Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Set resolution of screenshot image of 3D rendering



  • Hi All,

    I have developed a Qt application which can render 3D files.
    One of its features is an option to take screenshots of the current state of the 3D rendering.

    Here is the code snippet,

    // Set capture entity
    view->setCaptureEntity(sceneRoot);
    
    // Save the rendering by calling this method
    void My3DQtViewer::saveImage(QString filename)
    {
        m_screenshotfilename = filename;
        m_renderCaptureReply = m_renderCapture->requestCapture();
        connect(m_renderCaptureReply, SIGNAL(completed()), this, SLOT(saveImageToFile()));
    }
    
    // Save image to file
    void My3DQtViewer::saveImageToFile()
    {
        m_renderCaptureReply->saveImage(m_screenshotfilename);
    }
    

    The code works fine and I am able to take screenshots perfectly.
    Is there any way I can control the resolution/quality of the image being saved?

    If I can present the user with options to change the resolution of the output image, how will I incorporate this in the code?

    Thanks


Log in to reply