[Interest] Scripting within Qt6 and QJSEngine

Rainer Goebel rainergoebel at gmail.com
Mon Nov 14 18:38:16 CET 2022


Sorry for the indeed too strong formulation - and thanks for the link to the very interesting “declarative widgets” project of KDAB!

Best wishes

Rainer

> On 14 Nov 2022, at 12:19, Ulf Hermann via Interest <interest at qt-project.org> wrote:
> 
>> I think that QML/JS is not viable for scripting of QtWidgets since
>> public functions are not available when registering Qt classes as
>> types (only slots and Q_INVOKABLE functions next to properties).
>> Without the public class functions only very basic functionality is
>> exposed to the scripting engine. For custom classes one has of course
>> control over what will be exposed but one can not change this for
>> existing QtWidget classes (except when changing source code).
> 
> "Not viable" is a bit harsh. There are limits to this approach, but
> people have done it before. See for example
> https://www.kdab.com/declarative-widgets/ . If you want to create the
> whole widgets UI declaratively in QML, you're probably going to hit some
> major road blocks. However, it doesn't sound like that was the plan
> here. If you just need some additional functions exposed to C++, you can
> create your own proxy types with additional Q_INVOKABLEs.
> 
> best regards,
> Ulf
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list