hello ppl,

I have reimplemented paintCell, i want to give the cells of my table a color.. i have 10 cells and i want that the 5 cells should get a color.. like the first cell white and the second yellow and the third white, fourth yellow .....

this is my code i am only able to color the 3 cells ...

Qt Code:
  1. void myTable::paintCell(QPainter *p, int row, int col, const QRect &cr, bool selected, const QColorGroup &cg)
  2. {
  3.  
  4. int numRows = this->numRows();
  5. int countRows = numRows;
  6.  
  7. for(int i = 0; i < numRows ; i++)
  8.  
  9. if (row == numRows-- || row == numRows+i || row == numRows-i || row == numRows+i
  10. || row ==numRows-i)
  11. {
  12. QColorGroup colorGroup(cg);
  13. colorGroup.setColor(QColorGroup::Base, QColor("#ffffbb"));
  14. QTable::paintCell(p, row, col, cr, selected, colorGroup);
  15. }
  16. else
  17. {
  18. QTable::paintCell(p, row, col, cr, selected, cg);
  19. }
  20.  
  21. }
To copy to clipboard, switch view to plain text mode 

can anyone take a look at the code?
thanx in advance