Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138529

Qt WebView: Provide an example to demonstrate integrating WebView into a C++ GUI

    XMLWordPrintable

Details

    Description

      Currently, Qt WebView only provides a QML API. This has been mostly fine since the primary use-case for Qt WebView is to support mobile platforms where Qt WebEngine is unavailable and Qt Quick is recommended over widgets.

      However, the arrival of the Microsoft WebView2 plugin (QTBUG-75747) changes things: This plugin makes it feasible to integrate a lightweight web view into a pure C++ desktop application.

      For developers in such cases - who have no experience with QML or how to integrate it with C++ - it would be beneficial for us to provide a simple working example to show how to achieve this integration.

       

      Suggestion

      1. Use the Minibrowser example as a starting template
      2. Convert the Qt Quick Controls in the example into Qt Widgets, and use QQuickWidget to host the WebView itself
      3. Expand the role of the Utils class to serve as a bridge between the C++ GUI and the QML WebView

       

      Bonus: Consider a multi-module Demo which incorporates Qt Network Auth too, like what's described for Qt WebEngine at https://doc.qt.io/qt-6/qt-oauth2-browsersupport.html#using-qt-webengine

       

      Notes
      It looks like a proper C++ API is being considered for Qt WebView (see QTBUG-131837). Once that is done, the example should show the use of the official C++ API instead. But in the meantime, it would still be nice to show the QQuickWidget approach.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              docteam Qt Documentation Team
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes