[PyQt] Background color for cells in QTableView

Marc Rossi mrossi19 at gmail.com
Sat Jun 25 03:54:48 BST 2011


Yes, tried without stylesheet with no luck (just tried it again to see if I
missed something).  Thought about that as it feels like that Role is
disabled somehow.

On Fri, Jun 24, 2011 at 7:26 PM, David Boddie <david at boddie.org.uk> wrote:

> On Fri Jun 24 20:30:32 BST 2011, Marc Rossi wrote:
>
> > 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.
>
> Just a thought: have you tried it without the stylesheet?
>
> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110624/f47011d7/attachment.html>


More information about the PyQt mailing list