Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76183

Provide information about rendering progress in QWebEnginePage

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.1
    • WebEngine
    • None

    Description

      Scenario 1:
      1. Run the snippet below (the image will be downloaded and saved in cache)
      2. Run the snippet again

      Actual result:
      See attached image scenario_1.png (only red background is rendered).

      Expected result:
      The image is fully rendered.

      Scenario 2:
      1. Uncomment the line that disables cache
      2. Run the snippet

      Actual result:
      See attached image scenario_2.png (bottom part of the image is not rendered).

      Expected result:
      The image is fully rendered.

      Adding delay using timer helps but it not suitable fix for production use.

      #include <QApplication>
      #include <QWebEngineProfile>
      #include <QWebEngineView>
      
      auto html =  "<!DOCTYPE html>"
      "<html lang=\"en\">"
      "<head>"
      "  <meta charset=\"UTF-8\">"
      "  <style>"
      "  img { max-width:100%; max-height:100%; }"
      "  div { height: 270px; width: 540px; }"
      "  body { margin: 0; background-color: red; }"
      "  </style>"
      "</head>"
      "<body>"
      "<div>"
      "  <img src=\"https://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x5400x2700.png\">"
      "</div>"
      "</body>"
      "</html>"
      ;
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
      //    QWebEngineProfile::defaultProfile()->setHttpCacheType(QWebEngineProfile::NoCache);
      
          QWebEngineView view;
          view.show();
          view.resize(540, 270);
      
          QObject::connect(&view, &QWebEngineView::loadFinished, [&view](bool isOk) {
              if (!isOk)
                  return;
              view.grab().save("qt_page.png", "PNG");
          });
      
          view.setHtml(html);
          return app.exec();
      }
      

      Attachments

        1. scenario_1.png
          scenario_1.png
          3 kB
        2. scenario_2.png
          scenario_2.png
          714 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            krzysztof_sakowski Krzysztof Sakowski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes