I used the QModelIndex's model to color the cell using the setData method that was mentioned above, but as part of slot rather than a delegate. This will highlight whatever cell the user clicks on.

Qt Code:
  1. void MyParentWidget::init()
  2. {
  3. connect(((QAbstractItemView*)this->table), SIGNAL(pressed(const QModelIndex&)),
  4. this, SLOT(highlightCell(const QModelIndex&)));
  5. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void MyParentWidget::highlightCell(const QModelIndex &cellIndex)
  2. {
  3. for(int i=0; i<cellIndex.model()->columnCount(); i++)
  4. {
  5. for(int j=0; j<cellIndex.model()->rowCount(); j++)
  6. {
  7. if(i == cellIndex.column() && j == cellIndex.row())
  8. {
  9. ((QStandardItemModel*)cellIndex.model())->item(cellIndex.row(), i)->setData(QBrush(Qt::yellow),
  10. Qt::BackgroundRole);
  11. }
  12. else
  13. {
  14. ((QStandardItemModel*)cellIndex.model())->item(cellIndex.row(), i)->setData(QBrush(Qt::white),
  15. Qt::BackgroundRole);
  16. }
  17. }
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

You can modify & extend this behavior to meet your needs.