Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QTextBrowser or QWebView?

I need to render some HTML content (created by the application) and I'm wondering whether I should use QTextBrowser or QWebView. Although they seem quite similar, the doc doesn't discuss the differences between then.

I guess QWebView is almost a full-featured browser, but how about QTextBrowser? Does it also use webkit? Am I likely to run into some limitations if I use it?

like image 512
laurent Avatar asked Dec 01 '11 05:12

laurent


1 Answers

QTextBrowser supports only a subset of HTML and CSS, documenation see here. It has the advantage that it is lightweight, QWebView uses a lot more code and ressources.

Some more information The answer is accurate, however I feel compelled to complete it with some more info (OP). As a warning, read through the provided link to get the tags and styles that work. em sizes don't seem to work at all so set all your sizes in pixels; HR styling is extremely limited; bottom-border styling is not available (which could have been a good alternative to HR); . So don't do your design in Firefox and expect it's going to work in Qt. It most likely won't. Check the ref when things don't work as you except and tweak as you go. Eventually, it's probably possible to do many designs with QTextBrowser but it's better to check as you go.

like image 81
hmuelner Avatar answered Oct 18 '22 20:10

hmuelner