[Qt-qml] Unable to use external JS file with QML
Colin Kern
colin.kern at gmail.com
Tue Apr 13 18:52:16 CEST 2010
On Tue, Apr 13, 2010 at 10:14 AM, Matthias Ettrich
<matthias.ettrich at nokia.com> wrote:
> On Tuesday 13 April 2010 12:56:29 ext Jack Wootton wrote:
>> Hello,
>>
>> It was recommended I post this question on
>> qt-qml at trolltech.com<mailto:qt-qml at trolltech.com> after first posting it
>> on Forum Nokia here:
>> http://discussion.forum.nokia.com/forum/showthread.php?p=724730
>>
>> QML documentation states that JavaScript can be integrated with QML:
>> http://doc.qt.nokia.com/4.7-snapshot/qdeclarativejavascript.html
>>
>> I've created a simple QML file (Test.qml) which imports an external
>> JavaScript file (a.js).
>>
> [...]
>
>>
>> The Application Ouput panel shows the error 'TypeError: Result of
>> expression 'Misc.doubleFloat' [undefined] is not a function'. The function
>> works fine if I inline it and remove the qualifier:
>>
>
>
> Hi,
>
> your code works just fine with today's Qt on Linux, i.e. you are not missing
> anything obvious.
>
Did the older versions of QML support importing of js files that way
(import "a.js" as Misc)? I know the old { Script: a.js } way of
including js files doesn't work anymore, was that replaced with the
new way, or were both always an option?
Colin
More information about the Qt-qml
mailing list