QWebView or QWebEngineView

32,879

Solution 1

I would give QtWebEngine a try. It is replacing QtWebKit for a reason.

If you control the HTML that is getting rendered, then it probably doesn't hurt to use QWebKit. Just make sure you test your pages beforehand.

QWebView uses WebKit as the backend.

http://doc.qt.io/qt-5/qwebview.html#details

QWebEngineView uses Chromium as the backend.

http://doc.qt.io/qt-5/qwebengineview.html#details

WebKit is what is used in Konqueror on Linux and Rekonq. Its not bad, but its not as robust across general (and often imperfect) web pages/html in my opinion.

Chromium is a much newer, faster and more robust engine.

I don't know all the technical details specifically, but QWebEngine is a big step in the right direction. I've found this mostly from my own experimenting and empirical usage.

To give WebKit a decent try, look at this project and try a variety of pages:

http://qtweb.net/

https://github.com/magist3r/QtWeb

Here is some more info about QtWebEngine v QtWebKit

http://wiki.qt.io/QtWebEngine

http://en.wikipedia.org/wiki/WebKit

http://wiki.qt.io/QtWebKit

Solution 2

As for me I can't see some very important features in QWebEngineView. First of all you can't access to all frames on page, and you can't run JS in all frames. The next one is that you cant use QNetworkAccessManager for control view underline layer. So for now I can't see any solutions for some issues, like this How to disable sound on flashplayer in my custom application? . I want to believe that it is possible to solve it in some way, becouse QWebEngineView works much faster and seems like it have no (or less) memory leak issues then QWebView.

Solution 3

Framework: WebKit vs WebEngine

There used to be Qt WebKit since 2007 up to version 3. According to this Qt blog and here It is replaced by new Chromium-based web engine which is Qt WebEngine. According to the link Qt WebKit works fine right now, and will continue to do so in the years to come but if you want to have all the latest and greatest HTML5 features available for your application or device, you should consider moving over to Qt WebEngine.

As this blog says: Qt 5.4 also still contains the older Qt WebKit module. Qt WebKit is still supported, but as of Qt 5.4 we consider it done, so no new functionality will be added to it. We are also planning to deprecate Qt WebKit in future releases, as the new Qt WebEngine provides what is needed. In

My Decision: I prefer to go with the latest QtWebEngine specially when I am in the initial stage. If I hit the wall then maybe I revert to the Qt WebKit. QML: WebView vs WebEngineView.

For having a browser item in QML there are two items WebView and WebEngineView.

WebView with the same name has been defined in both WebKit and WebEngine. Documentation for WebView in WebKit is here. It should have the import QtWebKit 3.0.

For using the WebView bound to WebEngine which is mentioned in this documentation, we need to have this import: import QtWebView 1.0. But we will highly likely face an error #5 and #6 which the solutions to debug is states in the link.

I will use the latter WebView i.e the one which is provided by WebEngine. The proof that it is related to WebEngnie is the debug solution to error #5 and #6. From now on, WebView refers to the one offered by WebEngine in this document.

As this blog says: In Qt 5.4, Qt WebView is provided which offers a more limited API to embed the web browser that is native to the underlying operating system for use cases where the full Qt WebEngine isn’t needed, or where it can’t be used because of restrictions coming from the underlying OS. In Qt 5.4, the Qt WebView module supports iOS and Android. It supports embedding the native web engines of the underlying operating system into Qt, and is currently available for Android and iOS. Because of this, Qt WebView also gives a convenient light-weight solution for simple web document integration.

WebEngineView allows QML applications to render regions of dynamic web content. A WebEngineView component may share the screen with other QML components or encompass the full screen as specified within the QML application.It is my choice in applications which are not going to be executed in iOS and Android.

Note: It is According to this blog QtWebView will fall back to using QtWebEngine when possible. In the meantime that they are making more platforms possible with WebView. It is also mentioned as a reply to a QT-Bug that: While we don't have native WebView implementations for the OS X, Window etc. we can fallback to use QtWebEngine

My Decision: WebEngineView in non Android and iOS applications.

Share:
32,879
graywolf
Author by

graywolf

Updated on August 21, 2020

Comments

  • graywolf
    graywolf almost 4 years

    Are there any functional differences between QWebView and QWebEngineView? If I understand correctly, QWebView is webkit, while QWebEngineView is blink. Are there any differences to the programmer? Does one offer more customization of look & feel over the other?

    • MrEricSir
      MrEricSir over 9 years
      The answer really depends on whether you care about forward compatibility or not -- Qt will be dropping WebKit support at some point in the future.
    • graywolf
      graywolf over 9 years
      Is there a time frame for this? Like 5.5 or it's still to be specified?
    • MrEricSir
      MrEricSir over 9 years
      According to the Qt 5.4 release announcement, WebKit support will be deprecated in 5.5 and no new features will be added. Realistically it's unlikely they'll remove it entirely until Qt 6, because that would (obviously) break binary compatibility.
    • davidkomer
      davidkomer about 8 years
      It seems to me that QWebView is the only option when targeting iOS or Android and that QWebEngineView is only available on desktops. Is this correct?
    • Adrian Maire
      Adrian Maire almost 5 years
      I vote to open, as there are notable differences between both, and thus, a list of differences would not be opinion base, still very useful.
  • Vincas Dargis
    Vincas Dargis over 9 years
    QtWebKit is being deprecated in Qt 5.5 : wiki.qt.io/New-Features-in-Qt-5.5#Deprecated_Functionality
  • graywolf
    graywolf about 9 years
    that's a good point.. but since qtwebkit will be depredecated, I don't see what other choices are here :/ if I find solution, I'll let you know