Skip to main content

Qt native WebView bridge with PySide6 bindings

Project description

FIT WebView Bridge

Description

FIT WebView Bridge is a cross‑platform Qt widget (C++/Objective‑C++) with PySide6 bindings that wraps the OS‑native web engines:

  • Windows → Edge WebView2
  • macOS → WKWebView
  • Linux → WebKitGTK (with GStreamer for codecs)

It exposes a unified Python API for browser control and enables forensic viewing/capture of content, including media requiring proprietary codecs (e.g., H.264/AAC), without custom QtWebEngine builds or codec redistribution burdens (system codecs are used). All controls (UI and app logic) are delegated to the PySide window.

Why this project

QtWebEngine (Chromium) does not enable proprietary codecs by default, and redistributing them requires licensing. Alternatives (building QtWebEngine with codecs or using QtWebView/QML) have portability/control limitations. The chosen path is to leverage native engines, achieving codec compatibility and full control via a Python API.

Repository layout

fit-webview-bridge/
├─ CMakeLists.txt
├─ cmake/                   # Find*.cmake, toolchains, helpers
├─ include/fitwvb/          # Public headers (API)
├─ src/
│  ├─ core/                 # Facade / common interfaces
│  ├─ win/                  # Edge WebView2 backend (C++)
│  ├─ macos/                # WKWebView backend (Obj-C++)
│  └─ linux/                # WebKitGTK backend (C++)
├─ bindings/pyside6/        # Shiboken6: typesystem & config
├─ tests/                   # Unit / integration
└─ examples/                # Minimal PySide6 demo app

Interface (methods/slots + signals)

Methods / slots

  • load(url)
  • back()
  • forward()
  • reload()
  • stop()
  • setHtml(html, baseUrl)
  • evalJs(script, callback)

Signals

  • urlChanged(QUrl)
  • titleChanged(QString)
  • loadProgress(int)
  • loadFinished(bool)
  • consoleMessage(QString)

Note: the API is uniform across OSes; implementations delegate to the native engine.

Prerequisites

Common

  • CMake (>= 3.24 recommended)
  • Ninja (generator)
  • Python 3.9+
  • PySide6 and Shiboken6 (for Python bindings)
  • Platform build toolchain

Windows

  • MSVC (Visual Studio 2022 or Build Tools) and Windows SDK
  • Microsoft Edge WebView2 Runtime
  • WebView2 SDK (NuGet/vcpkg)

macOS

  • Xcode + Command Line Tools
  • Objective‑C++ enabled (.mm)
  • Frameworks: WebKit, Cocoa

Linux

  • GCC/Clang, pkg-config
  • WebKitGTK dev packages (e.g., webkit2gtk-4.1 or distro equivalent)
  • GStreamer (base + required plugins for codecs)

Build (indicative)

git clone https://github.com/fit-project/fit-webview-bridge.git
cd fit-webview-bridge
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_PYSIDE6_BINDINGS=ON
cmake --build build
# (optional) ctest --test-dir build

Examples

PySide6 samples in examples/ demonstrate URL loading, JS injection, and signal handling.

Codec & licensing notes

The project does not redistribute proprietary codecs: it leverages codecs already provided by the OS. End‑user usage must comply with the relevant licenses/formats.

Project status

Initial/alpha (API subject to change).

Fit Web — Project rationale and options for proprietary codecs

Fit Web is the FIT project's scraper module designed to forensically acquire and preserve web content: https://github.com/fit-project/fit-web.

Like the other modules, Fit Web is based on PySide (Qt for Python). It currently uses QtWebEngine, which is a Chromium wrapper.

The problem

By default, Chromium does not enable proprietary audio/video codecs, notably H.264 and AAC.

Options considered

1) Build QtWebEngine with proprietary codecs

Enable the -webengine-proprietary-codecs option.
Documentation: https://doc.qt.io/qt-6/qtwebengine-overview.html

Drawbacks

  • Must be done for all supported operating systems.
  • The build requires very powerful machines (e.g., difficulties on a MacBook Air M2 with 16 GB RAM).
  • Licensing: distributing H.264 and AAC requires a license.

2) Use QtWebView

QtWebView relies on the OS’s native web APIs; for proprietary‑codec content it uses the system’s codecs.
Pros: no custom builds, no direct license handling.
Cons: the UI layer is QML, geared toward lightweight (often mobile) UIs, so it doesn’t provide full browser control compared to QtWebEngine.

Documentation: https://doc.qt.io/qt-6/qtwebview-index.html

3) Implement a native Qt widget (C/C++) per OS

Develop a Qt widget (usable from PySide6) that embeds the system’s web engine:

  • Windows → Edge WebView2
  • macOS → WKWebView
  • Linux → WebKitGTK (with GStreamer for codecs)

Advantages

  • No redistribution licensing: leverage the codecs already provided by the OS.
  • A common API can be exposed to PySide6.
  • More control than QtWebView, without QML’s limitations.

Disadvantages

  • Medium‑to‑high complexity to implement.
  • Requires C++ and, on macOS, Objective‑C++.
  • Requires custom CMake to include libraries and linking.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fit_webview_bridge-0.2.9a5.tar.gz (27.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fit_webview_bridge-0.2.9a5-cp313-cp313-macosx_11_0_arm64.whl (91.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fit_webview_bridge-0.2.9a5-cp312-cp312-macosx_11_0_arm64.whl (91.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fit_webview_bridge-0.2.9a5-cp311-cp311-macosx_11_0_arm64.whl (91.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file fit_webview_bridge-0.2.9a5.tar.gz.

File metadata

  • Download URL: fit_webview_bridge-0.2.9a5.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fit_webview_bridge-0.2.9a5.tar.gz
Algorithm Hash digest
SHA256 6ceabe11a60210dc0457feb78580272f054a3d39eb01b5cb2905da5e368f8411
MD5 59ec51f1270d4edac93c504df14c6705
BLAKE2b-256 c737bc246e12f9961ebc926e414a44d9a9f3c3f44f69d52ab590481ce2f6b983

See more details on using hashes here.

File details

Details for the file fit_webview_bridge-0.2.9a5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fit_webview_bridge-0.2.9a5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 141ae511b9ea24c11d86020e4e0ac4adb28faf606d016beee4470ea4cc6eb199
MD5 8b72279b9069a8133db4eec04bc6c495
BLAKE2b-256 086474604b0cc1aacc70a176b1b4aee41970b3906e713582499e00b572a063d2

See more details on using hashes here.

File details

Details for the file fit_webview_bridge-0.2.9a5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fit_webview_bridge-0.2.9a5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31e12b0f005be53494d1e4a5b46463a230ee661b0c47c554a9de52ce1ba10811
MD5 c83065f83277f15e9ff358f68adcd289
BLAKE2b-256 430d1b863ee32adcb72dc3979431b30d2816296535cda5f1092b8961440c6f25

See more details on using hashes here.

File details

Details for the file fit_webview_bridge-0.2.9a5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fit_webview_bridge-0.2.9a5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9dc83f0b0171fa64c06839b90106239bb3a3c674feb75b063babfa8c41a0dbc1
MD5 f7ceb92633355cf55a4e41ea1d5c325f
BLAKE2b-256 0a13f0436651eb2f06f3da8f18c19fb7e4c777c0e8b1cee7f142d532c439cce6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page