Results 1 to 2 of 2

Thread: How to change the color of odd (or even) lines in a list of QtreeWidgetItems ?

  1. #1
    Join Date
    Jul 2011
    Location
    Paris
    Posts
    31
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to change the color of odd (or even) lines in a list of QtreeWidgetItems ?

    Hello,

    I am using a QTreeWidget to display a list of names. How can I modify the color in each line? My purpose is to set the color of the background line in even or odd lines only, to have a "striped view".

    Thanks!

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to change the color of odd (or even) lines in a list of QtreeWidgetItems ?

    Qt Code:
    1. treeWidget.setAlternatingRowColors(true)
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. The following user says thank you to Santosh Reddy for this useful post:

    Sergex (22nd April 2013)

Similar Threads

  1. font color of list view
    By maarvi in forum Newbie
    Replies: 7
    Last Post: 8th May 2011, 17:07
  2. QwtPlotCurve color for connecting lines
    By orignihn in forum Qwt
    Replies: 1
    Last Post: 28th April 2011, 08:08
  3. Replies: 1
    Last Post: 14th April 2011, 07:34
  4. Replies: 3
    Last Post: 22nd January 2010, 17:46
  5. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 23:25

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.