From 388251ce343c617fc7a383485e9417a5306adb14 Mon Sep 17 00:00:00 2001 From: Kaloyan Chehlarski Date: Wed, 5 Nov 2025 16:25:46 +0100 Subject: Add runJavascript() to C++ API The API follows what we have in WebEngine, with an optional std::function callback. No world ID argument is provided, however; most of the backends don't support the concept. The new function is not exposed to QML, since we cannot expose std::function arguments. Instead, the existing QML API is kept, and calls to it simply redirect to the C++ implementation. Also removes runJavaScriptPrivate() from QWebView, and its related implementation details in the plugins. Task-number: QTBUG-131837 Change-Id: Idc1e492916e17caa3f061c0b2738b3c735837cf8 Reviewed-by: Michal Klocek --- src/plugins/wasm/qwasmwebview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/wasm/qwasmwebview.cpp') diff --git a/src/plugins/wasm/qwasmwebview.cpp b/src/plugins/wasm/qwasmwebview.cpp index ca93c5e..31a7579 100644 --- a/src/plugins/wasm/qwasmwebview.cpp +++ b/src/plugins/wasm/qwasmwebview.cpp @@ -195,11 +195,12 @@ void QWasmWebViewPrivate::deleteAllCookies() qWarning("deleteAllCookies() not supported on this platform"); } -void QWasmWebViewPrivate::runJavaScriptPrivate(const QString &script, int callbackId) +void QWasmWebViewPrivate::runJavaScript(const QString &script, + const std::function &resultCallback) { Q_UNUSED(script); - Q_UNUSED(callbackId); - qWarning("runJavaScriptPrivate() not supported on this platform"); + Q_UNUSED(resultCallback); + qWarning("runJavaScript() not supported on this platform"); } QWebViewSettingsPrivate *QWasmWebViewPrivate::settings() const -- cgit v1.2.3