Webassembly - QML contents are not being drawn until I start to move the mouse
-
Hello,
I am building my QML app for WebAssembly. Everything works fine, except that QML contents are not being drawn until I start to move the mouse.
Is there any way to force drawing or to fix this issue in a different way?
Thank you for any help in advance!
-
My QML app for WebAssembly shows the same behavior.
I found a workaround which may or may not resolve your issue.
All happens while application wasm is loaded, compiled and run.
The html file controls this process.
There are three sections in the html which Qt generates by default: qtspinner, qtstatus and qtcanvas.
qtspinner shows Qt logo while wasm is loaded.
qtstatus shows loading information (eg. loading, compiling, ...).
qtcanvas is the area where application draws.
The html body element contains property "onload=init()" which starts Wasm loading.
Source code of script init() ends html body element.
It builds a QtLoader object.
Among QtLoader properties there is 'showCanvas' one, which hides qtspinner and shows qtcanvas when wasm app is ready to run.
As you said and I confirm, browers (I tested Crome, Safari and Firefox) generate no redraw event while this switch happens, so user has to move mouse or tap or rotate screen (my app is a mobile one) to generate a redraw event.
My workaround consists in adding a backgound image to qtcanvas which resembles wasm app output and suggests users to take an action. It may be a splash screen or something else, but its scope is clear: generate an event which starts things.
I hope this may help you.