summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qtloader.js
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2021-11-24 15:42:19 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-03-31 18:47:17 +0200
commit4ff5a571b3e7fc3c2c83b7f96a6899197be72b3f (patch)
treeee303a860cd35c93c69620100a9fb9c97b77a73b /src/plugins/platforms/wasm/qtloader.js
parentaa4a2bb1e1775a61514f6c1906a92970728e4c62 (diff)
wasm: Support non-canvas container elements
Support specifying that Qt should use a div element as the root container, in which case canvas management is moved to Qt C++ code. This enables us to take ownership of the canvas and its configuration. In addition, it allows creating child elements for the Qt container (canvas element children have a special role are as fallback elements displayed in case the browser can’t show the canvas) Remove support for reading Module.canvas, which was deprecated in Qt 5. Add support for reading Module.qtContainerElements, which can be either a canvas element (legacy) or a div element (preferred). Deprecate qtCanvasElements and print warning on usage. Change QWasmScreen to accept either a canvas or any html element. In the latter case, create the canvas and configure it as required by Qt. Change-Id: I57df8fb5772b2bfbba081af3f572b8b0e7d51897 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qtloader.js')
-rw-r--r--src/plugins/platforms/wasm/qtloader.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js
index 08bf0ed421..4f5bfcc2d8 100644
--- a/src/plugins/platforms/wasm/qtloader.js
+++ b/src/plugins/platforms/wasm/qtloader.js
@@ -142,7 +142,7 @@ function QtLoader(config)
// Qt properties. These are propagated to the Emscripten module after
// it has been created.
- self.qtCanvasElements = undefined;
+ self.qtContainerElements = undefined;
self.qtFontDpi = 96;
function webAssemblySupported() {
@@ -431,13 +431,13 @@ function QtLoader(config)
module.ENV[key.toUpperCase()] = value;
}
// Propagate Qt module properties
- module.qtCanvasElements = self.qtCanvasElements;
+ module.qtContainerElements = self.qtContainerElements;
module.qtFontDpi = self.qtFontDpi;
});
self.moduleConfig.mainScriptUrlOrBlob = new Blob([emscriptenModuleSource], {type: 'text/javascript'});
- self.qtCanvasElements = config.canvasElements;
+ self.qtContainerElements = config.canvasElements;
config.restart = function() {