[webkit-qt] Qtwebkit 5.212 setuserstylesheet() is taking 7seconds time first time on startup

Konstantin Tokarev annulen at yandex.ru
Wed Dec 2 22:31:40 PST 2020

03.12.2020, 08:44, "Ramakanth Kesireddy" <rama.kesi at gmail.com>:
> Question: Is there any API to reference the CSS file from page as the html is set dynamically using webview->setHtml() instead of setuserstylesheet?

You can use standard way of loading external CSS in HTML, i.e. <link rel="stylesheet" type="text/css" ...>

> Does it helps if we use QByteArray instead m_webView->settings()->setUserStyleSheetUrl( QUrl("data:text/css;charset=utf-8;base64," + css.toBase64())); where css being QByteArray object of the stylesheet?

No, that would be worse.

> Question: Where can we view or verify the QWebInspector output after setting the below codes in application source?
> QWebPage *page = page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
> QWebInspector *inspector = new QWebInspector;
> inspector->setPage(page);

QWebInspector is a widget which needs to be show by your app, e.g. as a separate window or inside a layout.

If you are debugging on device you may want to use remote inspector instead. You need to set _q_webInspectorServerPort property on QWebPage object to desired port number (int), and connect to that port from your PC using WebKit-based browser.


More information about the webkit-qt mailing list