summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2024-04-17 16:25:49 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2024-04-22 15:22:12 +0000
commita5bdb2128e4dc5014d5753840f84b815a0486c06 (patch)
treee465fc4e4151b26de6f1b8fd0e4bdb6365a463bc /src/plugins/platforms
parentbd231cc051d6246f572af23d953c27a95e0846a8 (diff)
wasm: back out of calling onLoaded at first frame
Qt and application code expects that QScreen geometry should be available early in main(), after the QApplication constructor returns. This is not the case if onLoaded is called at later point in time, since the container element for the screen is typically made visible when onLoaded is called, and does not have valid geometry before. Change-Id: I62d87f01fce1cd601e7a70d842e22a61814c9db7 Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/wasm/qtloader.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js
index bbc0ac68ab..8027dd8fa9 100644
--- a/src/plugins/platforms/wasm/qtloader.js
+++ b/src/plugins/platforms/wasm/qtloader.js
@@ -23,7 +23,8 @@
* - fontDpi: number
* Specifies font DPI for the instance
* - onLoaded: () => void
- * Called when the module has loaded.
+ * Called when the module has loaded, at the point in time where any loading placeholder
+ * should be hidden and the application window should be shown.
* - entryFunction: (emscriptenConfig: object) => Promise<EmscriptenModule>
* Qt always uses emscripten's MODULARIZE option. This is the MODULARIZE entry function.
* - module: Promise<WebAssembly.Module>
@@ -172,9 +173,14 @@ async function qtLoad(config)
config.preRun = [];
config.preRun.push(qtPreRun);
+ const originalOnRuntimeInitialized = config.onRuntimeInitialized;
+ config.onRuntimeInitialized = () => {
+ originalOnRuntimeInitialized?.();
+ config.qt.onLoaded?.();
+ }
+
const originalLocateFile = config.locateFile;
- config.locateFile = filename =>
- {
+ config.locateFile = filename => {
const originalLocatedFilename = originalLocateFile ? originalLocateFile(filename) : filename;
if (originalLocatedFilename.startsWith('libQt6'))
return `${config.qt.qtdir}/lib/${originalLocatedFilename}`;