Results 1 to 3 of 3

Thread: Different foreground colors in one Row (in QTreeView)

  1. #1
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Different foreground colors in one Row (in QTreeView)

    hello everybody,

    I'm wondering if it is possible to set different colors in a row of a QTreeView without splitting it in different columns.
    For example I want something like this in my row:

    lessons (3)

    Is there a way to do this without splitting the row in different columns?

    Best regards

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Different foreground colors in one Row (in QTreeView)

    Hi,

    you can use a custom delegate or make a HTML-Delegate and set HTML as Qt:isplayRole. As for a HTML delegate search the forum or web. You will find some there...

  3. #3
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Different foreground colors in one Row (in QTreeView)

    Hey Lykurg,

    Yes, that seems to be the best solution. I will try it now with subclassing QStyledItemDelegate.
    Thanks for your reply

Similar Threads

  1. GraphicsView Foreground
    By augusbas in forum Qt Programming
    Replies: 11
    Last Post: 23rd June 2011, 12:06
  2. Colors of QTreeView
    By slava in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2008, 22:08
  3. How to keep window in foreground
    By szicsi in forum Qt Programming
    Replies: 5
    Last Post: 17th January 2008, 14:40
  4. QTreeView -- Alternating Row Colors Oddity
    By chuckshaw in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 19:41
  5. Updating Foreground for QGraphicsView
    By tts80 in forum Qt Programming
    Replies: 5
    Last Post: 4th January 2007, 15:28

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
  •  
Qt is a trademark of The Qt Company.