How to Enable Debugging in WebKit Inspector so It's Available On Page Load?



  • I can enable debugging in WebKit Inspector manually by opening it, going to the Scripts tag, choosing 'Always enable' and then clicking 'Enable Debugging'. However, if I close the Qt app and open it again, that all has to be done again, the upshot being that I can't seem to find a way to have debugging enabled for the page's initial load.

    The QWebInspector page even has a section on "Inspector configuration persistence," but following the directions there seems to have no effect. Does anybody know how to either programatically enable debugging for the inspector or else how to get the settings to actually persist?



  • In fact, it appears the setting is lost if I so much as close and re-open the inspector, regardless of whether I close the app. I'm creating the inspector as follows:

    @// Docs say needed for QtWebKit to persist config
    QCoreApplication::setOrganizationName("foo");
    QCoreApplication::setApplicationName("bar");
    ...

    webView->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable);
    ...

    QWebInspector* inspector = new QWebInspector();
    inspector->setPage(webView->page());
    inspector->setVisible(true);@



  • Turns out the docs neglect to mention that you also need something like:
    @webView->settings()->enablePersistentStorage("");@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.