QT 5.4 WebEngine dev tools for javascript

ε祈祈猫儿з 提交于 2020-01-02 06:37:42

问题


I'm creating an application using QWebEngineView and QWebEnginePage. I was wondering if there is a way to active the Web Dev Tools?

I need to debug the html, javascript code like you do it using Google Developer Tool on Chrome.

If it is not possible in QT 5.4 does anyone know when it is planned to be included in future versions of QT ?


回答1:


add these line to your code

#ifdef QT_DEBUG
    qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "9000");
#endif

after launching your application start google chrome then navigate to http://localhost:9000 you will get developer tools




回答2:


You can do it with older QWebView, see QWebSettings::DeveloperExtrasEnabled.

Docs have nothing about same for QWebEngineView, but I found this link (look at line 47). I didn't try if it works, but you can try. May be dev tools will be available in one of the following QT versions.




回答3:


And here is a bit more flexible solution: to launch application with command line parameter --remote-debugging-port=XXXX. It's automatically routed by QApplication to the Blink (or whatever QWebEngine is) internals, so there is no additional work like arguments parsing needed; and it can be changed without app rebuild.

Upd: frankly speaking, I had used it only with 5.5 & 5.6, perhaps it unsupported in 5.4




回答4:


set command line "remote-debugging-port=XXXX";but there's a problem, when the application exit, it will produce a crash



来源:https://stackoverflow.com/questions/28297469/qt-5-4-webengine-dev-tools-for-javascript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!