IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Qt WebEngine Widgets C++ Classes

Provides C++ classes for rendering web content in a QWidget based application.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Qt WebEngine Widgets C++ Classes

Provides C++ classes for rendering web content in a QWidget based application.

Classes

  • QWebEngineView: The QWebEngineView class provides a widget that is used to view and edit web documents.

Detailed Description

The Qt WebEngine Widgets module provides a web browser engine as well as C++ classes to render and interact with web content.

To link against the module using build with qmake, add the following QT variable to your qmake .pro file:

 
Sélectionnez
QT += webenginewidgets

For build with CMake use the find_package() command to locate the needed module components in the Qt6 package and target_link_libraries() to link against the module:

 
Sélectionnez
find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)
target_link_libraries(target PRIVATE Qt6::WebEngineWidgets)

The minimum amount of code needed to load and display an HTML page requires just implementing the QWebEngineView class.

 
Sélectionnez
#include <QApplication>
#include <QWebEngineView>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QWebEngineView view;
    view.load(QUrl("https://qt-project.org/"));
    view.resize(1024, 750);
    view.show();
    return app.exec();
}

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+