Skip to content
Snippets Groups Projects
Commit fccd9b2a authored by Morten Sorvig's avatar Morten Sorvig
Browse files

Port examples to Qt 6.7

The Emscripten entry function name is now unique based
on the application name ("$APPNAME_entry"), and must be
specified when creating the wasm instance.

Also some drive-by fixes.
parent 8256fdb0
Branches 6.7
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Qt Background Loading</title> <title>Qt Background Loading</title>
<script src="../testapp/testapp.js"></script> <script src="../testapp/testapp.js"></script>
<script src="../testapp/qtloader.js"></script>
<script> <script>
window.addEventListener('load', async () => { window.addEventListener('load', async () => {
...@@ -14,8 +15,11 @@ ...@@ -14,8 +15,11 @@
// config object containing standard Emscripten configuration options. // config object containing standard Emscripten configuration options.
// In addtion, Qt app instances reads a couple of options like "qtContainerElements" // In addtion, Qt app instances reads a couple of options like "qtContainerElements"
// at startup. // at startup.
let instance = await createQtAppInstance({ let instance = await qtLoad({
"qtContainerElements": [container] qt: {
containerElements: [container],
entryFunction: testapp_entry
}
}); });
// At this point the Qt instance has been created; update the // At this point the Qt instance has been created; update the
......
...@@ -18,7 +18,11 @@ ...@@ -18,7 +18,11 @@
window.data = new Uint8Array([1, 2, 3 ,4]); window.data = new Uint8Array([1, 2, 3 ,4]);
window.addEventListener('load', async () => { window.addEventListener('load', async () => {
const instance = await qtLoad({qt:{}}); const instance = await qtLoad({
qt: {
entryFunction: testapp_entry
}
});
// enable the "Call C++" button which calls the function exported from jsinterop.cpp. // enable the "Call C++" button which calls the function exported from jsinterop.cpp.
const callCppButton = document.getElementById("callcpp"); const callCppButton = document.getElementById("callcpp");
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
const instance = await qtLoad({ const instance = await qtLoad({
qt: { qt: {
containerElements: [container], containerElements: [container],
modulePromise: module, module: module,
module: module, // ### decide on which one entryFunction: testapp_entry
} }
}); });
container.style.visibility = "visible"; container.style.visibility = "visible";
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<p>The application windows will appear below, when loaded.</p> <p>The application windows will appear below, when loaded.</p>
<div id="appcontainer1" style="width:320px; height:200px; visibility:hidden"></div> <div id="appcontainer1" style="width:320px; height:200px; visibility:hidden"></div>
<p>Window below not showing? Upgrade to Qt >= 6.5.</p > <br>
<div id="appcontainer2" style="width:320px; height:200px; visibility:hidden"></div> <div id="appcontainer2" style="width:320px; height:200px; visibility:hidden"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -18,7 +18,11 @@ ...@@ -18,7 +18,11 @@
{ {
// Create test app instance via the default window.createQtAppInstance entry function // Create test app instance via the default window.createQtAppInstance entry function
// set by testapp.js // set by testapp.js
const instance = await qtLoad({}); const instance = await qtLoad({
qt: {
entryFunction: testapp_entry
}
});
// The Qt instance has been created; enable ui. // The Qt instance has been created; enable ui.
let addWindow = document.getElementById("create-window-button"); let addWindow = document.getElementById("create-window-button");
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
const instance = await qtLoad({ const instance = await qtLoad({
qt: { qt: {
containerElements: containers, containerElements: containers,
entryFunction: testapp_entry
} }
}); });
}); });
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
// Create Qt application instance. This instance exports openPopup and // Create Qt application instance. This instance exports openPopup and
// closePopup, which we call below. See ../testapp/popup.cpp for the // closePopup, which we call below. See ../testapp/popup.cpp for the
// implementation. // implementation.
window.instance = await qtLoad({}); window.instance = await qtLoad({
qt: {
entryFunction: testapp_entry
}
});
let openPopup = document.getElementById("open-popup"); let openPopup = document.getElementById("open-popup");
openPopup.disabled = false; openPopup.disabled = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment