Results 1 to 2 of 2

Thread: How to change background and font color of QTreeView using HTML code

  1. #1
    Join Date
    Apr 2020
    Posts
    4
    Qt products
    Qt5

    Default How to change background and font color of QTreeView using HTML code

    Hi, i wanna know it it's possible to change background and font color of QTreeView using html code,
    I know its possible using css like this

    Qt Code:
    1. {background-color: yellow;}");
    To copy to clipboard, switch view to plain text mode 

    but, can it be done with html code something like this

    Qt Code:
    1. <QTreeView style="background-color:grey;">
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to change background and font color of QTreeView using HTML code

    can it be done with html code something like this
    No. Style sheets use css, not html. Maybe you are confusing this with the Rich Text HTML subset which is used to customize the text strings in QLineEdit, QTextEdit and other text-based widgets.

    You could always define your own XML-based language for defining styles, but your software would have to parse that and translate it into Qt's variant of css before you could apply it as a widget style.
    Last edited by d_stranz; 8th April 2020 at 00:52.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Change font color of whole application
    By clepto in forum Qt Programming
    Replies: 2
    Last Post: 29th May 2012, 12:44
  2. Change font color of QListView row
    By Phlucious in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2012, 19:42
  3. Changing font color for a single item in a QTreeView
    By Doug Broadwell in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2007, 20:14
  4. How do I change the font color in QTextBrowser?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 29th November 2006, 13:08
  5. Change Font Color of Label and CheckBox
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 15th June 2006, 11:24

Tags for this Thread

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.