开发者

Can Qt's QWebView display programmatically generated XML?

开发者 https://www.devze.com 2022-12-30 07:35 出处:网络
Using Qt 4.6, I can dynamically add to an HTML page like this: ui->webView->page()->mainFrame()->documentElement().findFirst(\"body\").appendInside(\"<i>some text</i>\\n\");

Using Qt 4.6, I can dynamically add to an HTML page like this:

ui->webView->page()->mainFrame()->documentElement().findFirst("body").appendInside("<i>some text</i>\n");

However, if I QWebView::load() an XML file, it displays it with the correct CSS styling (from an processing instruction), but doesn't show any changes when I do something like:

ui->webView->page()->mainFrame()->documentElement().findFirst开发者_如何学编程("lines").appendInside("<line>hello</line>\n");

Why is it treating them differently, and is there a way to modify an XML document in the same way I can an HTML one?


Try using setUrl() rather than load(). If that magically works it's a bug.

0

精彩评论

暂无评论...
验证码 换一张
取 消