Hello,

I am using following code to assign data and color to contents of QTableView:

Qt Code:
  1. for(y=0; y<7; y++)
  2. {
  3. if(y==6)
  4. {
  5. if(nepopolno)
  6. item->setData("krizec",Qt::DisplayRole);
  7. else
  8. item->setData("kljukica",Qt::DisplayRole);
  9.  
  10. }
  11. else
  12. item->setData(ukaz.value(y).toString(),Qt::DisplayRole);
  13.  
  14. item->setData(ukaz.value(6).toString(),Qt::UserRole);
  15.  
  16. item->setBackground(Qt::red);
  17. model.setItem(vrsta,y,item);
  18. }
To copy to clipboard, switch view to plain text mode 

Variable y represents column as you can see. Problem I face is that only first column is colored. If I debug with debugger, then I see that item->setBackground() method is certainly called for every QStandardItem of model that is assigned to QTableView.
Any clues how to write this code correctly? Or is there some other issue with Qt?