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

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 :
    http://qt-project.org/doc/qt-4.8/qwebpage.html

    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