Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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:

    "
    -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=arm
    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
    -DENABLE_WEBKIT2=OFF -DENABLE_OPENGL=OFF
    -DENABLE_GEOLOCATION=OFF -DENABLE_DEVICE_ORIENTATION=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF -DUSE_LIBHYPHEN=OFF
    -DPORT=Qt
    -DCROSS_COMPILE=ON
    "

    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