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");
if(!currentFile.
open(QFile::WriteOnly|QFile
::Text)) {
return;
}
s= in.readAll();
s.
replace("$STRINGPDF",
QString(url
));
qDebug()<<s;
currentFile.close();
}
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();
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks