Results 1 to 2 of 2

Thread: Setting the background color of a header in TableView

  1. #1
    Join Date
    Jun 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Setting the background color of a header in TableView

    I have subclassed QAbtractTableModel and am using a standard QTableView in QT Designer. In implementing the headerData() routine for the model, I find if I return a value for Qt::ForegroundRole, the header text shows up in a different color as I expect it to, but with BackgroundRole, nothing happens. With the data() routine, both Foreground and Background work and the colors in the cells show up. I saw a thread from a couple of years ago suggesting this may be a problem with Windows styles and that stylesheets were the work around, but it's unclear to me where one would even apply the style sheet and how (i.e. is it in the model or the view and what do I do in either case). In any case, the behavior of headerData() is inconsistent and I shouldn't have to use this workaround. Any help appreciated.

    Sunil

  2. #2
    Join Date
    Apr 2013
    Posts
    4
    Qt products

    Default Re: Setting the background color of a header in TableView

    Hve you found a solution because I have the same problem.

Similar Threads

  1. Replies: 2
    Last Post: 17th July 2010, 21:07
  2. Replies: 1
    Last Post: 11th September 2009, 17:03
  3. setting background color and repositioning
    By mind_freak in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2009, 06:22
  4. setting background color of QMessageBox
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2009, 13:26
  5. Replies: 2
    Last Post: 10th March 2006, 20:46

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.