Results 1 to 9 of 9

Thread: Color table row with ItemDelegate

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Color table row with ItemDelegate

    You can do it from the delegate. The core of the functionality will be exactly the same as the one I posted above, you just need to place it in the delegate. Subclass QItemDelegate and reimplement its paint function. You should then insert the already mentioned code there (of course you need to change it slightly but the general idea remains) so that it changes the palette of the "option" param and then call the base class implementation to handle the rest.

    It's possible that this will not work (depends if the default delegate looks at the palette to render the background -- I'm not sure of that). In that case just fill the background yourself using QPainter::fillRect() before calling the base implementation of the paint method.

  2. The following user says thank you to wysota for this useful post:

    dexjam (29th June 2006)

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