Results 1 to 2 of 2

Thread: Applying stylesheet for HTML tags in QTextBrowser via QApplication::setStylesheet

  1. #1
    Join Date
    Jan 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Applying stylesheet for HTML tags in QTextBrowser via QApplication::setStylesheet

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Applying stylesheet for HTML tags in QTextBrowser via QApplication::setStylesheet

    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()).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Matching HTML tags
    By pucara_faa in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2010, 13:19
  2. Html tags in QTreeView
    By 1111 in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2009, 01:41
  3. QFontMetrics and HTML tags
    By vonCZ in forum Newbie
    Replies: 1
    Last Post: 14th August 2008, 12:13
  4. QTextBrowser, add support for custom tags
    By qtcos in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2007, 16:43
  5. QApplication::setStyleSheet()
    By Ryhel in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2007, 13:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.