Results 1 to 10 of 10

Thread: How to interrupt QScriptValu::call()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to interrupt QScriptValu::call()

    This is what your code returns:

    "TypeError: Result of expression 'fun' [fun(){return 115;}] is not a function."
    so your function code is plain wrong

    Here is the proper code:

    Qt Code:
    1. #include <QtGui>
    2. #include <QtScript>
    3.  
    4. int main(int argc, char **argv) {
    5. QApplication app(argc, argv);
    6. QScriptEngine engine;
    7. QScriptContext *context = engine.pushContext();
    8. QScriptValue v = context->activationObject();
    9. v.setProperty("fun", engine.evaluate("(function(){return 115;})"));
    10. QScriptValue result = engine.evaluate("fun()");
    11. engine.popContext();
    12. qDebug() << result.toString();
    13. return 0;
    14. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jul 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to interrupt QScriptValu::call()

    Ah now I understand and it's working too.

    Thanks a lot

Similar Threads

  1. Serial data interrupt when minimizing a display window.
    By nagabathula in forum Qt Programming
    Replies: 8
    Last Post: 14th June 2011, 09:03
  2. Replies: 2
    Last Post: 7th June 2011, 08:24
  3. Sending OS I/O interrupt signals!
    By nofortee in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2010, 15:42
  4. Interrupt/Exception caught while compiling Qt program
    By Qt Coder in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 22:08
  5. Control-C to interrupt is not working
    By rburge in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2006, 21:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.