[Interest] Scripting within Qt6 and QJSEngine
Allan Sandfeld Jensen
kde at carewolf.com
Wed Oct 5 10:11:48 CEST 2022
On Mittwoch, 5. Oktober 2022 09:28:19 CEST Christian Kandeler via Interest
wrote:
> On 9/26/22 17:47, Filippo Rusconi via Interest wrote:
> > Greetings,
> > my C++ software program (GUI) was scriptable using the QtScript module
> > of Qt5.
> >
> > I now would like to build it using Qt6 and to take the opportunity of
> > the port
> > to transition towards QJSEngine (QtScript is being deprecated).
> >
> > I searched around for a tutorial about converting a QtScript project to
> > QJSEngine but failed to find any.
> >
> > For example, I was looking for the new class that would replace the
> > QScriptClass
> > class.
> > Are there any lessons about transitioning from QtScript to QJSEngine
> > that I
> > might have overlooked?
>
> It's not a drop-in replacement. In particular, as far as I know, there's
> no QScriptClass equivalent.
>
> See also https://bugreports.qt.io/browse/QTBUG-45248.
>
I believe I worked around that by creating the array/object with JS and then
filling it. Same with injecting function objects, you insert an object with a
method, then use that method name as the function. Not the best looking but
workingas replacements.
Best regards
Allan
More information about the Interest
mailing list