Results 1 to 1 of 1

Thread: How to include a .js file in another .js file when working with QML and QtQuick2?

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: How to include a .js file in another .js file when working with QML and QtQuick2?

    No browser is involved here.

    Writing this syntax:
    Qt Code:
    1. var head= document.getElementsByTagName('head')[0];
    2. var script= document.createElement('script');
    3. script.type= 'text/javascript';
    4. script.src= 'helper.js';
    5. head.appendChild(script);
    To copy to clipboard, switch view to plain text mode 

    gives me:
    Qt Code:
    1. ReferenceError: document is not defined
    To copy to clipboard, switch view to plain text mode 

    What's the way out?


    Added after 27 minutes:


    Found the solution here: http://qt-project.org/doc/qt-5/qtqml...t-imports.html
    Thanks to koopajah from stackoverflow.
    Last edited by TheIndependentAquarius; 28th July 2014 at 10:12.

Similar Threads

  1. Replies: 1
    Last Post: 23rd May 2011, 04:53
  2. Replies: 3
    Last Post: 1st November 2010, 16:33
  3. Replies: 4
    Last Post: 9th May 2010, 16:18
  4. Replies: 2
    Last Post: 9th March 2010, 05:21
  5. Replies: 10
    Last Post: 15th June 2009, 19:44

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.