[Qt-interest] How to load page from Qt resource with AJAX?

sherzod_ sherzod.l at mail.ru
Thu Nov 11 09:50:11 CET 2010


Hello.

Let us have a resource "qrc:/root/sayHello.html" with a simple content 
<p>Hello, world!</p>.

I need to load the content of the resource to some <div> element by means of 
ajax, wich runs in a context of some other page in a QWebView.

---------------------------------------------------------------

<!-- qrc:/root/sayHello.html -->
<p>Hello, world!!!</p>

---------------------------------------------------------------

<!-- qrc:/root/index.html -->
<!DOCTYPE somekindofhtml>
<html>

<script type="text/javascript">
	/* use JQuery */
	$(document).ready(function (){
		$("#board")
		/* this doesn't work */
		.load("qrc:/root/sayHello.html"); 
	});
</script>

<body>
	<div id="board"></div>
</body>
</html>

---------------------------------------------------------------
// c++ code
QWebView webView;
webView.loadFromResource(":/root/index.html"); // Let it be


extra:
	tried all combinations of qrc, :, /, //, ///
	resource is in dll wich i d-ly load at runtime via plugin api

How to do it correct?
i'll be glad to any suggestions.




More information about the Qt-interest-old mailing list