htmlcssqtqtextbrowser

QTextBrowser not processing CSS properly


I am having problems with rendering HTML with QTextBrowser. It does not process some CSS properties such as tr height, table borders, etc. For instance,

This does not work: <table style=' border: 1px solid black;'> This does not work: <tr style='height: 10px'>

The code above DOES work on Google Chrome 31.

Is there an alternative for this, or is there any trick for solving this kind of issues? Using QWebView could be a good choice but it does not provide an append() method.

Could you please suggest me something?


Solution

  • QTextBrowser supports only a subset of HTML and CSS.

    If you need full support use QWebView, you can emulate appending with something like this:

    QString html = webView->page()->currentFrame()->toHtml(); //or mainFrame()
    html += "Something to append";
    webView->setHtml(html);