Running QtWebEngine with C++

10,332

Solution 1

It looks like it is only supported on a few compilers right now:

http://wiki.qt.io/QtWebEngine#Q:_On_which_platforms_will_it_run.3F

Try building with one of those configured, and it should work.

My guess is that basically the Chromium project it is built on is very complex with lots of dependencies and QtWebEngine hasn't been backported other compilers yet.

QtWebKit should still be supported most of the time, but QtWebEngine is where things are headed.

Hope that helps.

Solution 2

Webkit package installation can resolve the issue: [apt-get install libqt5webkit5-dev]

Share:
10,332
Michael Nielsen
Author by

Michael Nielsen

Updated on June 19, 2022

Comments

  • Michael Nielsen
    Michael Nielsen about 2 years

    I'm trying out Qt for the first time and want to create a very basic application which loads a website. I want to use Qt WebEngine.

    This is my helloworld.pro:

    TEMPLATE = app
    TARGET = hello
    DEPENDPATH += .
    INCLUDEPATH += .
    
    QT += webenginewidgets
    
    SOURCES += hello.cpp
    

    And this is my hello.cpp

    #include <QApplication>
    #include <QtWebEngineWidgets/QtWebEngineWidgets>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QWebEngineView *view = new QWebEngineView(parent);
        view->load(QUrl("http://qt-project.org/"));
        view->show();
    
        return app.exec();
    }
    

    When trying to compile I get the error:

    Project ERROR: Unknown module(s) in QT: QWebEngineView
    Project ERROR: Unknown module(s) in QT: webenginewidgets
    

    I guess I know that it cannot find the modules, but looking into the qt-documentation it seems as the right way to include them.

    I'm running QtCreator 3.4.2 on Qt 5.5.0.

    • Xian Nox
      Xian Nox almost 9 years
      Do you have the qtwebengine modules installed? This can be done either via the MaintenanceTool, or if you're running linux, you need to install the webengine packages.
  • Donald Duck
    Donald Duck almost 7 years
    Could you please provide more details? How to install the webkit package? Where should I type apt-get install libqt5webkit5-dev?
  • Amit Vujic
    Amit Vujic almost 7 years
    In terminal console first type [sudo su ] then apt-get install command. What OS you are using?
  • Donald Duck
    Donald Duck almost 7 years
    I'm using Mac on a virtual machine and I tried to do that and it said "command not found" when I tried to do apt-get install libqt5webkit5-dev.
  • Amit Vujic
    Amit Vujic almost 7 years
    I'm working on linux but presume that for MacOS you should check out installer [ man installer ]