Hello,

I have the following problem. I want to replace a string of a variable in a JavaScript file with a function in Qt.

Qt Code:
  1. url = "qrc:/res/res/text.pdf";
  2.  
  3. void WebView::open()
  4. {
  5. QFile currentFile("qrc:/res/res/pdf-viewer.js");
  6. if(!currentFile.open(QFile::WriteOnly|QFile::Text))
  7. {
  8. return;
  9. }
  10. QTextStream in(&currentFile);
  11. s= in.readAll();
  12. s.replace("$STRINGPDF",QString(url));
  13. qDebug()<<s;
  14. currentFile.close();
  15. }
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