I have a model/view app with a QTableView that I would like to have columns 2, 3 & 4 shaded a different color than the rest. My model sub-classes QAbstractTableModel and I also use a QSortFilterProxyModel. I assumed I could just override the data() method in my QAbstractTableModel derived class, returning the correct QBrush when called with role = Qt.BackgroundRole, but my data method NEVER gets called with this role. I currently use a stylesheet to set the entire background of the QTableView.<div>
<br></div><div>Not a Qt expert by any means but when I call model.roleNames() and print out the results I only see roles 0-5, no role 8 (Background). Not sure if this call returns all roles supported by the model or if it is just there as a utility func.</div>
<div><br></div><div>Any help would be greatly appreciated.</div><div><br></div><div>Marc</div>