4

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 ?

Prasad Silva
  • 1,020
  • 2
  • 11
  • 28
user1185305
  • 875
  • 2
  • 15
  • 26
  • I'm not sure, but an alternative is to embed Firebug Lite in your page. More info: https://getfirebug.com/firebuglite – MrEricSir Feb 03 '15 at 18:54

4 Answers4

5

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

Gilson PJ
  • 3,443
  • 3
  • 32
  • 53
0

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.

Mikhail Gerasimov
  • 36,989
  • 16
  • 116
  • 159
0

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

sendevent
  • 212
  • 1
  • 8
0

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

lily8561
  • 21
  • 3