Results 1 to 11 of 11

Thread: QScriptEngine

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Oct 2007
    Posts
    78
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScriptEngine

    But why do you want to "reference" the UI from the script? Something runs the script, right? So it can retrieve the result from the script and display it on the UI.
    The script itself is updating the ui, similar to the Calculator example.

    Wrong, you can use objects.
    My understanding of scripting is limited, so you are saying I can create an object inside the script pass it back to my c++ as a QScriptValue and then pass that back to the other script as an argument?

    If that is true that would be exactly what I needed, will just need to figure out the creation syntax for an object inside a script and setting its variables and returning it.

    Bob

    Edit:

    Looks like I could do something like
    Qt Code:
    1. function foo() {
    2.  
    3. myObject = new Object();
    4.  
    5. myObject.a = 1;
    6. myObject.b = 2;
    7.  
    8. return myObject;
    9. }
    To copy to clipboard, switch view to plain text mode 
    That should return the myObject as a QScriptValue that I can pass as an argument to the other script?
    Last edited by coderbob; 24th January 2010 at 19:09.

Similar Threads

  1. QScriptEngine in Qt 4.6.0
    By Fastman in forum Qt Programming
    Replies: 0
    Last Post: 25th December 2009, 21:00
  2. QTextCursor and QScriptEngine
    By roxton in forum Qt Programming
    Replies: 1
    Last Post: 31st October 2008, 19:47
  3. Replies: 3
    Last Post: 14th October 2008, 21:04
  4. Interpretting .pac script using QScriptEngine()
    By Saranakumardb in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2008, 12:12
  5. Interpretting javascript using QScriptEngine
    By Saranakumardb in forum Qt Programming
    Replies: 8
    Last Post: 31st July 2008, 18:56

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.