PDA

View Full Version : Applying stylesheet for HTML tags in QTextBrowser via QApplication::setStylesheet



FooSoft
1st January 2011, 18:18
Hello everyone,

I have an application that I'm trying to theme using one global stylesheet via the QApplication::setStylesheet API. This includes a QTextBrowser control which has a bunch of general unstyled HTML in it. What would be awesome is if I could change the way those HTML elements are represented using the global application style, but I'm at a loss about how to do this.

I haven't managed to find any syntax for referencing HTML elements below a QTextBrowser without actually injecting my stylesheet within <style> tags. Is what I'm trying to do possible, and if so, what's the syntax for it?

wysota
2nd January 2011, 11:54
Widget stylesheets and HTML stylesheets are two completely different mechanism, one can't be used for the other. What you could do is that you can load the same stylesheet file as a widget stylesheet and html stylesheet in your text document (QTextDocument::defaultStylesheet()).