Results 1 to 8 of 8

Thread: QTScript - getting the name of a QScriptValue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    13
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTScript - getting the name of a QScriptValue

    it does already work with arguments, but the nature of the code would result in a function call like mysimulation.newfunction("mysimulation"), where the simulation is used as the argument.

    anyway, i'm choosing the more complicated but resource friendly way of rebuilding the code, which the qtscript engine would have generated with the custom script, myself.

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTScript - getting the name of a QScriptValue

    I was not talking of giving the object's name as argument to the script generator function.

    What I meant was: forget about the script generator and just pass the simulationobject as parameter:

    fixedsimulationfunc(mysimulation);

    or better as it is more oop like:

    mysimulation.run();

    Here you use the this object to access mysimulation..

    ScriptCode:
    Qt Code:
    1. function run()
    2. {
    3. ++this.time;
    4. }
    5.  
    6. function()
    7. {
    8. // Initialize the run script.. maybe differently for different simulation objects?
    9. simulation.run = run;
    10. ...
    11. simulation.run();
    12. }
    To copy to clipboard, switch view to plain text mode 

    Maybe I did still not catch why you want to do this.. Maybe you are forced to use the structure as it is.

    Best of luck to you!

    Johannes

Similar Threads

  1. QtScript: default constructor question
    By QPlace in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2009, 19:36
  2. QtScript evaluation question
    By QPlace in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2009, 03:46
  3. QScriptValue with simple typedef types
    By JohannesMunk in forum Newbie
    Replies: 9
    Last Post: 14th May 2009, 15:07
  4. QtScript Binding problem with QWidget
    By zack in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 09:38
  5. QtScript Q_ENUM problem
    By oc2k1 in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2007, 16:07

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.