PDA

View Full Version : QTableView--keep same background color when selected



davethomaspilot
11th February 2014, 18:38
I'm using ::initStyeOption in an QStyledItemDelegate to color code the cell backgrounds based on the content of data associated with the cell contents.

I want to keep those backgrounds when the cell is selected and indicate the selection via a cell outline instead.

I can set the color for the selection background using a style sheet, but I can't figure out how to make it not to change when selected.

Is there a virtual method for the selection I need to implemented to dynamically return a background color, or is there an easier way?

Thanks,

Dave Thomas