Results 1 to 4 of 4

Thread: Colors of QTreeView

  1. #1
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Colors of QTreeView

    Hello all!
    I have a QStandardItemModel getting filled with the data and then dispalyed in QTreeView in a form. I would need to highlight few lines with a red color in that TreeView, let's say all lines which starts with A and the other lines remain black. I can't find color property neither in QStandardItemModel nor in QTreeView. Is it possible to make raws of different colors like this?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Colors of QTreeView


  3. #3
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Default Re: Colors of QTreeView

    Thank you. But I still think I'm missing something. It says "QAbstractItemModel has no member named setBackground"

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Colors of QTreeView

    Yes, but it has the data() and setData() methods and Qt::BackgroundColorRole. You can also implement your own item delegate and add a setBackground() method to it.

Similar Threads

  1. QTreeView repaint
    By graeme in forum Qt Programming
    Replies: 17
    Last Post: 13th March 2012, 14:27
  2. QTreeView -- Alternating Row Colors Oddity
    By chuckshaw in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 20:41
  3. QTreeView help
    By bepaald in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2007, 22:22
  4. QTreeView: Holding a line on screen
    By gri in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 12:42
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 15:24

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.