[Qt-interest] how to pass strings as args to evaluateJavascript() call?
Karthick
sppkarthick at gmail.com
Tue Mar 15 12:55:21 CET 2011
Thanks for ur reply.
On Mon, Mar 14, 2011 at 8:19 PM, Francesc Vila Garcia <
francesc.vila at imb-cnm.csic.es> wrote:
> Well, in C++, the variables aren't expanded into a string. You should look
> at something like QString arg() method:
>
> QString javascriptCode = QString("calcRoute(%1, %2)").arg(str1).arg(str2);
>
> Regards,
>
> Francesc
>
>
> On 03/14/2011 07:43 AM, Karthick wrote:
>
> Hi All,
> How to pass strings as args to evaluatejavascript() call?
> For example:
> I have a Javascript function in HTML which is given below.
> calcRoute(origin, destination);
>
> I have tried the following way.
> In Qt:
> I am calling JS function like evaluateJavascript("calRoute('germany',
> 'italy')");
> In this case, no issues. Here i passed the hard coded value.
> Instead of that, i will pass two strings as given below.
> char *str1, *str2;
> //memory allocation for str1 and str2
> strcpy(str1, "germany");
> strcpy(str2, "italy");
> evaluateJavascript("calcRoute(str1, str2)");
> In this case, no compilation error. but i am not getting proper output.
> whether is this correct way to pass strings like the one above or will do
> it in sum other way to pass?
> If anyone knows, please help me to solve this issue.
>
>
> --
> *Regards,*
> *Karthick
> *
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.comhttp://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
--
*Regards,*
*Karthick
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110315/36f96777/attachment.html
More information about the Qt-interest-old
mailing list