← Back to team overview

ubuntu-phone team mailing list archive

Re: Js variables in QML giving a null output

 

Hello.

Seems that you are doing this
>> Qt.openUrlExternally("
http://www.google.com/a/wa/bestMatchForQueryString?s="; + Js.song + "&a=" +
Js.band);10;
and this
>> var song = inputSong;
in separate QML files.
Add ".pragma library" at the beginning of your *.js file to share it
between *.qml files.
More info can be found here:
http://qt-project.org/doc/qt-5.0/qtqml/qtqml-javascript-resources.html


2013/11/3 kurt hodgin <buntukernel@xxxxxxxxx>

>  when using this code
>
> QML code snippit
>
>  Qt.openUrlExternally("
> http://www.google.com/a/wa/bestMatchForQueryString?s="; + Js.song + "&a="
> + Js.band);10;
>
> JavaScript file
>
> var song = inputSong;
> var band = inputBand;
>
>
> the url puts null in my two variable positions
>
> If I get rid of var it says undefined instead of null and goes to a
> different page, I know losing var makes it global but i'm not sure if that
> helps. The variables are connected to two different text boxes, for know
> one button shows the web page like the code above. the other shows the pure
> output thats how i see if it says null or undefined.
>
>
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>
>

References