Distributing a Qt app in a flatpak with WebEngine

I am attempting to package my Qt app as a flatpak.
It relies heavily on QtWebEngine, so I used this as a base app: GitHub - flathub/io.qt.qtwebengine.BaseApp

I am using qt6 with org.kde.Sdk and org.kde.Platform.
It packages successfully but then I get this error immediately when the app opens: module “QtWebEngine” plugin “qtwebenginequickplugin” not found.

The line in question is simply “import QtWebEngine” (QML).
The reason I am posting this here is because when the app is run on the host system (without flatpak) it works completely fine.

Hey, while I haven’t experienced this problem, it’s usually easier, if you can share your manifest etc. if that’s possible for your application.

Here is the manifest:

app-id: ca.stevestudios.Swirl
runtime: org.kde.Platform
runtime-version: ‘6.5’
sdk: org.kde.Sdk
base: io.qt.qtwebengine.BaseApp
base-version: ‘6.5’
command: swirl
finish-args:

  • –share=ipc
  • –socket=x11
  • –socket=wayland
  • –filesystem=host
  • –device=dri
  • –env=QTWEBENGINEPROCESS_PATH=/app/bin/QtWebEngineProcess
    cleanup-commands:
  • /app/cleanup-BaseApp.sh
    modules:
  • name: swirl
    buildsystem: simple
    build-commands:
    • install -D ca.stevestudios.Swirl.appdata.xml /app/share/metainfo/ca.stevestudios.Swirl.appdata.xml
    • install -D ca.stevestudios.Swirl.desktop /app/share/applications/ca.stevestudios.Swirl.desktop
    • install -D ca.stevestudios.Swirl.svg /app/share/icons/hicolor/scalable/apps/ca.stevestudios.Swirl.svg
    • install -D ca.stevestudios.Swirl-symbolic.svg /app/share/icons/hicolor/symbolic/apps/ca.stevestudios.Swirl-symbolic.svg
      sources:
    • type: file
      path: ca.stevestudios.Swirl.desktop
    • type: file
      path: ca.stevestudios.Swirl.svg
    • type: file
      path: ca.stevestudios.Swirl-symbolic.svg
    • type: file
      path: ca.stevestudios.Swirl.appdata.xml
  • name: swirl-bin
    buildsystem: cmake-ninja
    config-opts:
    • -DCMAKE_BUILD_TYPE=Release
      sources:
    • type: archive
      path: swirl-bin.tar.gz

…where swirl-bin is the Qt app source code.

qt.qpa.qgnomeplatform: Could not find color scheme “”
QQmlApplicationEngine failed to load component

It’s also worth mentioning that these errors (or maybe warnings) appear right before the main problem I have just described.

I am starting to think it is a bug with the base app (Not only am I sure I’ve tried everything in my power, but there is zero info on the web about this issue). I made an issue here: QtWebEngine import not found in QML · Issue #290 · flathub/io.qt.qtwebengine.BaseApp · GitHub

Also, it seems to only be a problem in QML, the C++ headers work fine.

I seem to have the same problem, but with a cmake project trying to reference Qt5’s webengine in the qt5.15-24.08 version of org.Kde.Sdk. It works fine on my regular Alpine machine with their qt5-qtwebengine package with the same cmake project. Is there something weird or incomplete about QtWebengine is contained in the SDK in regards to build files and such? It seems prone for some reason to confusing other dev tools that are looking for QtWebengine.

-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:13 (find_package):
  By not providing "FindQt5WebEngine.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5WebEngine", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5WebEngine" with
  any of the following names:

    Qt5WebEngineConfig.cmake
    qt5webengine-config.cmake

  Add the installation prefix of "Qt5WebEngine" to CMAKE_PREFIX_PATH or set
  "Qt5WebEngine_DIR" to a directory containing one of the above files.  If
  "Qt5WebEngine" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!

Qtwebengine is not in the SDK, It’s in the baseapp here GitHub - flathub/io.qt.qtwebengine.BaseApp

1 Like

Thank you so much, that explains a lot and you saved me from much confusion!