[Interest] Qt 5 -> 6: In QQmlEngine, Qt.Checked, etc. are no longer available

Thorbjørn Lindeijer bjorn at lindeijer.nl
Fri Jun 24 14:41:51 CEST 2022

On Fri, Jun 24, 2022, at 12:50, Ulf Hermann wrote:
>> Right, normally when evaluating a script, any error can be caught and reported however you wish, but this does not work when the script execution is trigger through a signal connection. In this case, when using QJSEngine, errors are always printed to the standard out, whereas the QQmlEngine allows reporting these through its "warnings" signal.
> Well, I would like to see a bug report with a minimal reproducer for 
> this. How do you produce a signal connection in pure JS?

You just expose a QObject-derived class instance to JS which has a signal, and then in JS you can do:

    someObject.someSignal.connect(() => {});

See https://doc.qt.io/qt-6.2/qtqml-syntax-signals.html#connecting-signals-to-methods-and-signals

But if you trigger a runtime error, like:

    someObject.someSignal.connect(() => {

And then emit "someSignal" from C++, then the connected JS function gets executed, but without any way of catching and reporting the resulting error, unless you use QQmlEngine and connect to the "warnings" signal.


More information about the Interest mailing list