QTextBrowser font-size stylesheet doesn't work all the time
I'm trying to display this HTML with a QTextBrowser:
Quote:
<h1 style="font-size:100pt;">Test</h1>
The strange thing is that it doesn't work with setHtml, but looks like the stylesheet is parsed, because when I use toHtml (which wraps it in a span-element), and set it again with setHtml, it works.
Example code:
Code:
#include <QtGui/QApplication>
#include <QDialog>
#include <QTextBrowser>
#include <QDebug>
int main(int argc, char *argv[])
{
textBrowser.setHtml("<h1 style=\"font-size:100pt;\">Test</h1>");
#if 1
QString html
= textBrowser.
toHtml();
qDebug() << html;
textBrowser.setHtml(html);
#endif
textBrowser.setGeometry(0, 0, 500, 500);
dlg.setGeometry(0, 0, 500, 500);
dlg.exec();
return 0;
}
Change "#if 1" to "#if 0" and it doesn't work. But the toHtml and setHtml workaround has other problems. Maybe I'm doing something wrong? Or is this a bug? (I've tried it with Qt 4.6.2)