Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view errors on Qt WebView control?

Tags:

c++

javascript

qt

I think my web page has some JavaScript errors that make QWebView to not work. Is there some simple way to see JS errors while I'm running the debug build?

like image 544
Tower Avatar asked Apr 16 '26 03:04

Tower


1 Answers

Override the javaScriptConsoleMessage function:

http://doc.qt.io/qt-5/qwebenginepage.html#javaScriptConsoleMessage

As the documentation says, the default implementation does nothing...you can dump it as debug output, or whatever. See also this article:

Redirecting JavaScript console messages in a Qt hybrid application (Internet Archive)

like image 93
HostileFork says dont trust SE Avatar answered Apr 17 '26 17:04

HostileFork says dont trust SE