[Solved] Debugging scripts that run in a QWebView widget
-
Hi there,
anybody knows how to debug scripts that run into a QWebView widget?I've thought about attaching a QScriptEngineDebugger to the QScriptEngine of the main QWebFrame of that widget, but to the best of my searches on the web and in the documentation, there is no QScriptEngine accessible from the QWebFrame interface - I wonder what engine gets used by the evaluateJavaScript() slot.
Any hint or suggestion?
Thanks a lot for your attention!
-
Another solution, less intrusive is to subclass webpage and reimplement:
@
virtual void javaScriptAlert ( QWebFrame * frame, const QString & msg )
virtual bool javaScriptConfirm ( QWebFrame * frame, const QString & msg )
virtual void javaScriptConsoleMessage ( const QString & message, int lineNumber, const QString & sourceID )
virtual bool javaScriptPrompt ( QWebFrame * frame, const QString & msg, const QString & defaultValue, QString * result )
@[EDIT: added code formatting tags, Volker]
-
I just enabled it by adding this line in the constructor of my main window:
@
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
@Then I right-click on any QWebView at runtime and I select "Inspect" - more knowledgeable people around will give deeper insight, eventually.
-
Thanks a lot, entuland. It was really helpful.
[quote author="entuland" date="1294223335"]I just enabled it by adding this line in the constructor of my main window:
@
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
@Then I right-click on any QWebView at runtime and I select "Inspect" - more knowledgeable people around will give deeper insight, eventually.[/quote]
-
Another interesting idea that I worked with is use JsLint inside the frame.
-
Thank you! This saved me a patch of hair or two.
-
Hello entuland,
Could you please advise what solution was selected. I have the same question and still have no solution.
Thank you in advance,
Vadim