[Qt-interest] QScript Newbie Question

Bastian Bense bastibense at gmail.com
Sun Feb 7 11:44:15 CET 2010


Hello,

I think you have to give the function a name to make it work:

QScriptValue handler = eng.evaluate("function handleTextChanged(text) { print('text was changed to', text); }");

Bastian

Am 07.02.2010 um 11:38 schrieb Alexander Carôt:

> I just started using QScript and currently work with the sample code of the documentation. In that context I have a little problem with the following code:
> 
> QScriptEngine eng;
> QLineEdit *edit = new QLineEdit("",this);
> QScriptValue handler = eng.evaluate("function(text) { print('text was changed to', text); }");
> qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler);
> 
> It compiles fine but whenever I change the text of the edit field nothing happens. So, my question is how I can verify the functionality that the signal reaches the script-slot ? So far I expected to have the terminal message "text was changed to ..."  or am I mistaken ?





More information about the Qt-interest-old mailing list