Skip to content

Commit 3b72778

Browse files
authored
qt: support REMOTE_DEBUGGING_PORT (#1740)
1 parent a4158c0 commit 3b72778

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docs/api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Additional options that override default behaviour of _pywebview_ to address pop
126126
* `IGNORE_SSL_ERRORS` Ignore SSL errors. Disabled by default.
127127
* `OPEN_EXTERNAL_LINKS_IN_BROWSER`. Open `target=_blank` link in an external browser. Enabled by default.
128128
* `OPEN_DEVTOOLS_IN_DEBUG` Open devtools automatically in debug mode. Enabled by default.
129-
* `REMOTE_DEBUGGING_PORT` Enable remote debugging when using `edgechromium`. Disabled by default.* `SHOW_DEFAULT_MENUS` Show default menu on Cocoa. Enabled by default.
129+
* `REMOTE_DEBUGGING_PORT` Enable remote debugging when using `edgechromium` or `qt`. Disabled by default.* `SHOW_DEFAULT_MENUS` Show default menu on Cocoa. Enabled by default.
130130
* `SHOW_DEFAULT_MENUS` Show default menus on Cocoa. Enabled by default.
131131
* `WEBVIEW2_RUNTIME_PATH` Path to WebView2 runtime. You can use relative paths, which will be resolved relative to the application entry point with support of path resolution for most bundlers. If not set, the system installed runtime is used if present.
132132

docs/guide/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This will enable web inspector on macOS, GTK and QT (QTWebEngine only). To open
1313

1414
Debugging Python code on Android is not possible apart from printing message to `logcat`. Use `adb -s <DEVICE_ID> logcat | grep python` for displaying log messages related to Python. Frontend code can be debugged with WebView remote debugging. Refer to [this guide](https://developer.chrome.com/docs/devtools/remote-debugging/webviews/) for details.
1515

16-
Remote debugging is supported with the `edgechromium` renderer. To take remote debugging into use set `webview.settings['REMOTE_DEBUGGING_PORT']` to the port number you wish to run a debugger on.
16+
Remote debugging is supported with the `edgechromium` and `qt` renderers. To take remote debugging into use set `webview.settings['REMOTE_DEBUGGING_PORT']` to the port number you wish to run a debugger on.
1717

1818
There is no way to attach an external debugger to MSHTML. The `debug` flag enables Javascript error reporting and right-click context menu.
1919

webview/platforms/qt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,11 @@ def setup_app():
905905
global _app
906906
if settings['IGNORE_SSL_ERRORS']:
907907
environ_append('QTWEBENGINE_CHROMIUM_FLAGS', '--ignore-certificate-errors')
908+
if settings['REMOTE_DEBUGGING_PORT']:
909+
environ_append(
910+
'QTWEBENGINE_CHROMIUM_FLAGS',
911+
f'--remote-debugging-port={settings["REMOTE_DEBUGGING_PORT"]}',
912+
)
908913
_app = QApplication.instance() or QApplication(sys.argv)
909914

910915

0 commit comments

Comments
 (0)