qt - QWebFrame::evaluateJavaScript vs. script-tag in HTML -


I want to develop an application that uses QTWebKit and JQuery

What do I know Is it necessary to read JQuery from a file and evaluate it by javascript, or embed a script tag inside the "page" that is displayed inside the widget?

EDIT: It seems that at least partly I know this evaluation JavaScript will apparently work reliably; But if I do

  baseurl = QUrl.fromLocalFile (QDir.current (). AbsoluteFilePath ("doesntexist.html"); See. SitHTML (U ""  gt;  gt; script type = "text / javascript" src = "jquery-1.4.2.js" & gt; & lt; / Script & gt; & lt; / head & gt; body  

The file is never read from a disk (done with inotify). It also affects the basal.

  QUrl ("file: /") Qurl ("." );;;);;);  

or

  QUrl ("file: //")  

It has also tried to change the script SRC parameter to hard dr For the full path on Eve, and in front of a relative path without "./".

How do I get it (one side of the QT resource system) script tags working with local JS files Is it just bad documented, or am I forgetting something?

You can use your html to do something and modify it

  & lt; Script type = "text / javascript" src = ": / jquery-1.4.2.js" & gt;  

And do not forget the call macro Q_INIT_RESOURCE in the main menu

or javascript using the evaluation

  connect (see, signal (LoadFinished) (boole)), this, slot (loaded ())); ... zero MainWindow :: loadJQuery () {QFile file ("jquery-1.4.2.js"); File.open (QFile :: read-only); View-> Page () - & gt; Mainframe () - & gt; EvaluateJavaScript (file.readAll ()); }  

I think it is better to use the resource system.


Comments