Annoying White Screen Flash Before Webkit App Loads



  • I've built a Qt 5.5 widget-based application with the QWebView widget. However, unfortunately when the application loads (even when compiled and run through macdeployqt), it flashes a brief white screen for half a second before it displays the content.

    Is there anything I can do to never display the window until the HTML has finished rendering the first time?



  • I fixed it like so:

    1. Comment out the default w.show() in my main.cpp.
    2. I created a Q_INVOKABLE class method on main window called showAppWindow() that merely does a this->show().
    3. I did the steps to inject my C++ object (called cpp) into my Javascript via the C++ <==> Webkit bridge.
    4. In my index.html file, at the bottom before the ending BODY tag, I added this:
    <script type="text/javascript">
    try {
    	if (cpp) {
    		setTimeout('cpp.showAppWindow();',100);
    	}
    } catch(e){}
    </script>
    


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