Results 1 to 2 of 2

Thread: Can I include a script from script?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    2

    Default Can I include a script from script?

    I try to include a script from script

    Qt Code:
    1. class Script: public QObject
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. Script();
    7. public slots:
    8. QWidget* loadGUI(QString file);
    9. void load(QString file); //using engine->evaluate(file.tostring) to load js file
    10. };
    To copy to clipboard, switch view to plain text mode 

    main.js
    Qt Code:
    1. SCRIPT.load('calculator.js'); //class Calculator is define in calculator.js
    2. gg= SCRIPT.loadGUI('calculator.ui');
    3. new Calculator(gg);
    4. gg.show();
    To copy to clipboard, switch view to plain text mode 

    But I got the error : Calculator is not defined

    If I move some codes from main.js to calculator.ui

    main.js
    Qt Code:
    1. gg= SCRIPT.loadGUI('calculator.ui');
    2. SCRIPT.load('calculator.js');
    To copy to clipboard, switch view to plain text mode 
    calculator.js
    Qt Code:
    1. ........
    2. //add this code
    3. new Calculator(gg);
    4. gg.show();
    To copy to clipboard, switch view to plain text mode 
    It work very well
    Last edited by yycking; 22nd April 2009 at 06:29.

Similar Threads

  1. QApplication: no such file or directory
    By jochen_r in forum Newbie
    Replies: 13
    Last Post: 15th November 2008, 21:46
  2. Error: Using Multiple files
    By 3nc31 in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 09:23
  3. Painting problem
    By Mel in forum Qt Programming
    Replies: 10
    Last Post: 8th May 2007, 21:38
  4. Can't create an object : initialisation problem ?
    By Nyphel in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2007, 09:07
  5. use button from another Window
    By raphaelf in forum Qt Programming
    Replies: 11
    Last Post: 2nd March 2006, 20:31

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.