QtWebEngine调试
最近Qt引入了 QtWebEngine
模块。是否可以在 QWebEngineView
中调用开发人员工具并调试JavaScript代码? QWebView
使用
Recently Qt introduced the QtWebEngine
module. Is there a way to invoke developer tools and debug JavaScript code inside QWebEngineView
? It was possible with QWebView
using
page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
但我在 QWebEngineView $ c中找不到任何类似的选项$ c>。
我刚刚遇到了这个问题,因此我在此添加了后代。
I just ran across this so I added it here for posterity.
它刚刚被添加到Qt 5.5 git中。您必须通过环境变量 QTWEBENGINE_REMOTE_DEBUGGING =< port>
启用它。如果要调试嵌入式设备并且不能使用本地控制台,则可以放置 0.0.0.0:<port>
。然后您可以指向可以连接到 http://127.0.0.1 的位置来获取调试器。它将需要是基于铬的浏览器。您必须使用Chrome,还是可以使用快速纳米浏览器示例。
It was just added to Qt 5.5 git. You have to enable it via an environment variable QTWEBENGINE_REMOTE_DEBUGGING=<port>
. You can put 0.0.0.0:<port>
if you are doing debugging of an embedded device and cant use the local console. Then you can point can connect to http://127.0.0.1: to get the debugger. It will need to be a chromium based browser. Do you have to use Chrome, or you can actually use the "quick nano browser" example if you want.