Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/launch/launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "../core/plugin.hpp"
#include "../core/rootwrapper.hpp"
#include "../ipc/ipc.hpp"
#include "../webengine/webengine.hpp"
#include "build.hpp"
#include "launch_p.hpp"

Expand Down Expand Up @@ -74,6 +75,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
bool nativeTextRendering = false;
bool desktopSettingsAware = true;
bool useSystemStyle = false;
bool useQtWebEngineQuick = false;
QString iconTheme = qEnvironmentVariable("QS_ICON_THEME");
QHash<QString, QString> envOverrides;
QString dataDir;
Expand All @@ -91,6 +93,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
else if (pragma == "NativeTextRendering") pragmas.nativeTextRendering = true;
else if (pragma == "IgnoreSystemSettings") pragmas.desktopSettingsAware = false;
else if (pragma == "RespectSystemStyle") pragmas.useSystemStyle = true;
else if (pragma == "EnableQtWebEngineQuick") pragmas.useQtWebEngineQuick = true;
else if (pragma.startsWith("IconTheme ")) pragmas.iconTheme = pragma.sliced(10);
else if (pragma.startsWith("Env ")) {
auto envPragma = pragma.sliced(4);
Expand Down Expand Up @@ -222,7 +225,11 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
delete coreApplication;

QGuiApplication* app = nullptr;
auto qArgC = 0;
auto qArgC = 1;

if (pragmas.useQtWebEngineQuick) {
web_engine::init();
}

if (pragmas.useQApplication) {
app = new QApplication(qArgC, argv);
Expand Down
39 changes: 39 additions & 0 deletions src/webengine/webengine.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <QDebug>
#include <qdebug.h>
#include <qlibrary.h>
#include <qlogging.h>

namespace qs::web_engine {

inline void init() {
using InitializeFunc = void (*)();

QLibrary lib("Qt6WebEngineQuick");
if (!lib.load()) {
qWarning() << "Failed to load library:" << lib.errorString();
qWarning() << "You might need to install the necessary package for Qt6WebEngineQuick.";
qWarning() << "QtWebEngineQuick is not Loaded. Using the qml type WebEngineView from "
"QtWebEngine might lead to undefined behaviour!";
return;
}

qDebug() << "Loaded library Qt6WebEngineQuick";

auto initialize =
reinterpret_cast<InitializeFunc>(lib.resolve("_ZN16QtWebEngineQuick10initializeEv"));
if (!initialize) {
qWarning() << "Failed to resolve symbol 'void QtWebEngineQuick::initialize()' in lib "
"Qt6WebEngineQuick. This should not happen";
qWarning() << "QtWebEngineQuick is not Loaded. Using the qml type WebEngineView from "
"QtWebEngine might lead to undefined behaviour!";
return;
}

qDebug() << "Found symbol QtWebEngineQuick::initialize(). Initializing WebEngine...";

initialize();

qDebug() << "Successfully initialized QtWebEngineQuick";
}

} // namespace qs::web_engine