Given a snippet code in QWebpage section, what to put in the main cpp file ?

  • I am reading QWebPage section in Qt docs.
    And I would like to test the snippet code done in this section.
    I wanted to try this code but i did not know how to make it completely works.

    • I know what to put in the header file : i've put the declaration of the class Thumbnailer.
      And i've add the needed classes :
      #include <QObject>

    #include <QtWebKitWidgets/QWebPage>

    #include <QWebFrame>

    #include <QPainter>

    • I've put the rest of the snippet code in a cpp file.

    • There is no problem at this step, but the problem* is what to put the main cpp file to make it visible ?*

    Here is the link of the QWebPage class reference where the snippet code is :

    Thanks in advance for any enligtenment or help about that :)

  • Moderators

    what do you want to achieve exactly?
    The Thumbnailer snippet code just renders a screenshot to an image.
    If you want to display this image set it on a QLabel and show the label.
    If you want to show the webpage in your application you have to use QWebView widget.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.