[Interest] Scripting within Qt6 and QJSEngine

Ulf Hermann ulf.hermann at qt.io
Mon Nov 14 09:31:00 CET 2022


> That is an intesting question because it somehow pin points something 
> that is
> not clear to me. Perusing the documentation, I saw that QQmlEngine 
> derives from
> QJSengine. I cannot figure out which is best to employ in my use case:
> scripting a QtWidgets C++ application. Can I use QML as a scripting 
> language in
> a currently C++-only program ?

Sure, you can. QML, the language, is independent from any UI technology. 
Most people use it with Qt Quick, but no one forces you to use Qt Quick. 
When using widgets you'll have to do some more "boring" work yourself: 
There is no pre-made QtWidgets QML module, but you can certainly 
register the types you're interested in into your own modules using 
QML_FOREIGN.

Mind that structured and constructible value types will only be 
available from Qt 6.5 on. You can use the snapshot builds already for 
prototyping, though.

best regards,
Ulf


More information about the Interest mailing list