Results 1 to 2 of 2

Thread: Help QTableView

  1. #1

    Default Help QTableView

    How do I color the background of a QtableView the odd rows of green? And color even lines of red?

  2. #2
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Thanks
    23
    Thanked 32 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Help QTableView

    I dont know how to set the colors but to distinguish odd from even do something like


    Qt Code:
    1. for(int i=0;i<10;i++)
    2. {
    3. if ( i%2 == 0) //its even
    4. paint_red();
    5. else // its odd
    6. paint_green();
    7. }
    To copy to clipboard, switch view to plain text mode 
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

Similar Threads

  1. One Model, Two Views (QTreeView and QTableView)
    By dgarrett97 in forum Newbie
    Replies: 2
    Last Post: 14th September 2009, 18:10
  2. Replies: 5
    Last Post: 24th July 2009, 22:30
  3. Replies: 2
    Last Post: 7th June 2009, 10:47
  4. Very high CPU usage with QTableView and MVC
    By montylee in forum Qt Programming
    Replies: 7
    Last Post: 24th March 2009, 06:14
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

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.