Same_Andy
29th January 2016, 21:00
Hello,
I have the following problem. I want to replace a string of a variable in a JavaScript file with a function in Qt.
url = "qrc:/res/res/text.pdf";
void WebView::open()
{
QFile currentFile("qrc:/res/res/pdf-viewer.js");
QString s;
if(!currentFile.open(QFile::WriteOnly|QFile::Text) )
{
return;
}
QTextStream in(¤tFile);
s= in.readAll();
s.replace("$STRINGPDF",QString(url));
qDebug()<<s;
currentFile.close();
}
he finds the variable not in the specified file. Because you can see I have the absolute paths of the files specified.
please help me
thanks
I have the following problem. I want to replace a string of a variable in a JavaScript file with a function in Qt.
url = "qrc:/res/res/text.pdf";
void WebView::open()
{
QFile currentFile("qrc:/res/res/pdf-viewer.js");
QString s;
if(!currentFile.open(QFile::WriteOnly|QFile::Text) )
{
return;
}
QTextStream in(¤tFile);
s= in.readAll();
s.replace("$STRINGPDF",QString(url));
qDebug()<<s;
currentFile.close();
}
he finds the variable not in the specified file. Because you can see I have the absolute paths of the files specified.
please help me
thanks