You also can try QTableWidget::item() and QTableWidgetItem::setBackground().