Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.0
-
None
-
2efba0002d26b584c771aa9260e6d699e5ff8da3
Description
In http://doc.trolltech.com/4.6/scripting.html#using-signals-and-slots, there are snippets how to connect C++ signals to to script funtions. Those snippets work fine in Qt 4.5.x, but not in Qt 4.6.0. The problem seem to be in syntax how script function is defined:
For example, the following does not work in 4.6:
QScriptValue handler = eng.evaluate("function(text) { print('text was changed to', text); }"); qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler);
But adding the parenthesis () around the evaluated sentence, makes the example work again 4.6 (it works also in 4.5):
QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })"); qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler);
Should evaluation work without parenthesis? I assume this differenece is due to QtScript backend change to javascriptcore..