Hello,
I started to use script in qt a few days ago,
but I have a very basic (I suppose) problem :
how to use the maths function in a script?
(Because if I understand correctly theses functions exist : http://doc.trolltech.com/main-snapshot/ecmascript.html).
Maybe it is related to "importExtension("qt.core")" but I do not succeed to make it working.
Thanks a lot.

Here is an example of code I want to use :
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4.  
  5. QScriptEngine testEngine;
  6. QString content = "var stuff = cos(50);";
  7.  
  8. QScriptSyntaxCheckResult result = QScriptEngine::checkSyntax (content );
  9. if(result.state() != QScriptSyntaxCheckResult::Valid){
  10. QMessageBox::warning(0,"Erreur de syntaxe",result.errorMessage());
  11. return -1;
  12. }
  13.  
  14. testEngine.evaluate(content);
  15.  
  16. if (testEngine.hasUncaughtException()) {
  17. QMessageBox::warning(0,"Erreur d'execution", testEngine.uncaughtException().toString());
  18. }
  19.  
  20. return a.exec();
  21. }
To copy to clipboard, switch view to plain text mode 

This code returns "cos is undefined" from the evaluation.