I have a QTreeView which has a stylesheet applied to items with "QTreeView::item{background-color:#F7F7F7}". The view has a custom model and in the data method, I change the background of some specific cells like this :
Qt Code:
  1. if (index.column() == 3 && role == Qt::BackgroundColorRole)
  2. {
  3. return QColor("#F4FF81");
  4. }
To copy to clipboard, switch view to plain text mode 
But this is not working to overwrite the value set in stylesheet. Is there anyone who can tell me what I miss? Thanks!!!