×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    22

    QML external JS file not found

    Hello,

    I've created a simple QML file which imports an external JavaScript file:

    Test.qml
    Code:
    import Qt 4.6
    import "a.js" as Misc
    
    
    Rectangle {
        width: 200
        height: 500
    
        Text {
            text: Misc.doubleFloat(2.5)
            anchors.right: parent.right
        }
    }

    a.js
    Code:
    function doubleFloat(a) {
             a = parseFloat(a);
             return a*2;
         }

    Application Ouput panel shows

    Code:
    TypeError: Result of expression 'Misc.doubleFloat' [undefined] is not a function.
    The function works fine if I inline it and remove the qualifier:

    Test.qml
    Code:
    import Qt 4.6
    
    Rectangle {
        width: 200
        height: 500
    
        function doubleFloat(a) {
                 a = parseFloat(a);
                 return a*2;
             }
    
        Text {
            text: doubleFloat(2.5)
            anchors.right: parent.right
        }
    }
    a.js is in the same directory as Test.qml, so there should be no problem locating it. I have also tried providing the absolute path in the import statement. I still receive the same error.
    Last edited by anothertest; 2010-04-13 at 10:48.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QML external JS file not found

    Wise people say you should try this question in Qt-Qml mailing list
    http://lists.trolltech.com/mailman/listinfo/qt-qml

Similar Threads

  1. Replies: 2
    Last Post: 2007-11-07, 07:55
  2. No library file found matching 'libedll.lib{.lib|.a}' or 'edll.lib'
    By manish_mishra2005 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 5
    Last Post: 2007-08-28, 21:23
  3. No library file found matching 'libedll.lib{.lib|.a}' or 'edll.lib'
    By manish_mishra2005 in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2007-02-02, 11:12
  4. Replies: 1
    Last Post: 2005-05-26, 14:22
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×