I have a question that i really don't know.
Here is the my code.
QFile file( ":/direction.js");
{
msg.setText("Fail");
msg.exec();
}
else
{
from = "6";
QString functions
= file.
readAll();
QWebFrame* frame = ui->webView->page()->mainFrame();
frame->evaluateJavaScript( functions );
frame->evaluateJavaScript(script);
}
QString from;
QFile file( ":/direction.js");
if ( !file.open(QIODevice::ReadOnly | QIODevice::Text) )
{
msg.setText("Fail");
msg.exec();
}
else
{
from = "6";
QString functions = file.readAll();
QWebFrame* frame = ui->webView->page()->mainFrame();
frame->evaluateJavaScript( functions );
QString script = QString("Direction(%1);").arg( from );
frame->evaluateJavaScript(script);
}
To copy to clipboard, switch view to plain text mode
and the content of direction.js like :
function Direction (from)
{
alert("This is Direction");
alert(from);
}
function Direction (from)
{
alert("This is Direction");
alert(from);
}
To copy to clipboard, switch view to plain text mode
But i am very confused with the value of QString from.
when i put it : from="8".It run OK
But when i put it : from="a".It can not run.
If you know this problem.Please explain it for me.
Thanks and best regards!
Bookmarks