Qt World Summit: Submit your Presentation

Qtwebkit 5.212 setuserstylesheet() is taking 7seconds to apply stylesheet first time.

  • Am using Qt WebKit 5.212 Alpha4 release through yocto build on top of Qt 5.6.3 binaries and found good with respect to security bugs and fixes as recommended and QtTestBrowser works fine on target.

    Below are the cmake qtwebkit bb options:


    Below are the sample codes in our UiApp:
    webView = new QWebView();
    webView->setContextMenuPolicy( Qt::NoContextMenu );
    webView->settings()->setUserStyleSheetUrl( QUrl::fromLocalFile(<stylesheetpath.css> ) );//This API Takes 7 secs to apply stylesheet
    webView->settings()->setDefaultTextEncoding( "utf-8");

    Not sure why setUserStyleSheetUrl() takes more loading time of 7 secs when it is set through button click for the first time. However, subsequent stylesheet operations are fast in the order of ms.

    Am unable to reproduce the same in sample app where it takes only 300-400ms for the same api setUserStyleSheetUrl first time on target. The only difference in UIApp being it is set from child thread where QApplication instance is created.

    Appreciate your suggestions in this regard incase there are any missing QWebSettings to be set which causes synchronous loading of css stylesheet instead of asynchronous loading.

    Found that QWebPage creation takes 7s time on profiling. Any suggestions are welcome.

Log in to reply