Important: Please read the Qt Code of Conduct -

How to render WebEngineView correctly after scrolling?

  • Saving an image of a webpage with a WebEngineView works fine, but when I want to scroll and save another image, the resulting image does not show the website has been scrolled (it shows the top of the webpage).

    My question is: how do I scroll down in the QWebEngineView then save a screen shot that shows the correctly scrolled webpage?

    I take a screenshot at the top of the webpage, scroll down ~700 pixels, wait for a javascript callback to trigger which then takes another screenshot. The javascript and callback works fine (I observe the QWebEngineView scrolling).

    this->setScrollPageHandlerFunc([&] (const QVariant &result) {

    Screenshot code:

    void MainWindow::saveSnapshotScroll()
    QPixmap pixmap(this->size());
    view->page()->view()->render(&pixmap); + ".png");


    function scrollPage()
        var y = qt_jq.jQuery(window).scrollTop();

Log in to reply