Qml - QtWebEngine, QtWebKit, QtWebView

  • Hello,

    I am new to QtQuick, QML and I was playing with it to see if it matches the requirments for my new application. One of the needs is to show html code (local or remote). After some tests I am a bit confused about some aspects.

    I opened the webview example from Qt 5.4 and ran it on Linux 64bit. I notice it is using the new QtWebEngine module in the .pro file and also in the .cpp code with include QtWebEngine.h

    @qtHaveModule(webengine) {
    QT += webengine

    What happens if webengine is not available? What component is used? I suppose on Android/IOS the webengine component is not available and it will use a "native" component.

    In the qml file I find
    @import QtWebView 1.0@

    which is underlined with a red line (the Qt Creator-Design cannot find it's definition because qmlplugindump crashed). I suppose QtWebView is the Library name for the new QtWebEngine component. The example runs well without problems.
    Can I avoid this error in the QtCreator-Design?

    If I comment out the qtHaveModule(webengine) in the pro file and rebuild everything then at run time (Desktop Linux 64bit) the program will crash with a Segmentation Fault after loading the qml file:

    @0 QOpenGLContext::handle() const /home/xx/Qt/5.4/gcc_64/lib/libQt5Gui.so.5
    1 ?? /home/xx/Qt/5.4/gcc_64/plugins/platforms/libqxcb.so
    2 ?? /home/xx/Qt/5.4/gcc_64/qml/QtWebView/../../lib/libQt5WebEngineCore.so@
    Why does it crash? Because on Desktop there is no "native" alternative to the QtWebEngine?

    It will work again if I replace the import QtWebView 1.0 with import QtWebKit 3.0 without the need to add QT+=webkit to the pro file.
    Why it is not necessary to add QT+=webkit?

    What is the best approach for both Qt Quick Desktop/Mobile deployment? QtWebEngine or QtWebView?

    Last month I made a similar application but using Qt Widgets and at last I had to use QtWebKit because QtWebEngine was crashing sometimes (randomly after some usage).


Log in to reply

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