[Interest] QJSEngine with QRC
Scott Bloom
scott at towel42.com
Wed Oct 29 23:57:27 CET 2025
From: Interest <interest-bounces at qt-project.org> On Behalf Of Richard Weickelt
Sent: Wednesday, October 29, 2025 15:11
To: interest at qt-project.org
Subject: Re: [Interest] QJSEngine with QRC
On 10/29/25 19:09, Scott Bloom wrote:
> I have this working via a QRC based html file, using the WebEngine to
> process the javascript.
>
> The html, uses the qtwebchannel.js from the qrc, and then also loads 3
> javascript files via <script src="..."> tags, all via qrc:/ urls.
> (some of the tags are in the head and some in the body.
I guess you expect QJSEngine to render an image only. The HTML is just a vehicle to get the .js files into WebEngine, right?
Your .js files make use of async and await. Are you aware of https://bugreports.qt.io/browse/QTBUG-58620? If that is not a showstopper already, have you read about importing from .mjs files?
https://doc.qt.io/qt-6/qtqml-javascript-imports.html#imports-within-javascript-resources
=====
Correct, the HTML is purely a placeholder for the correct solution. The previous version (which I forked from) was based on Qt4 and the old web system. When I needed the functionality, I moved it forward to Qt6 + the latest core from the MathJax project.
As to the async, that would be problematic, a typical rendering can take up to a second or so, so calling for a rendering and waiting in a synchronous manner would provide for a less than satisfactory experience. But for now, Im more concerned about just getting the solution to work that doesn't required a complete Web Engine.
Thanks for the pointer to the javascrip-resources, Ill take a look, but I don't think that is the issue.
Scott
More information about the Interest
mailing list