I want to set the background for the editor (not the placeholder display created by the paint method) of an Item Delegate. I'm using the Qt::BackgroundRole for the data to set the initial background in the Paint method. But, when the user places focus on the item, and the editor gets drawn, I'd like to use a different background color in the delegate's rectangle. I've tried style sheets and selected color, I've tried setting the palette for the editor, I've tried drawing the background using the selection model's QModel index, but nothing seems to work. What shall I try next? I'm using a QTrieeView, a StandardItemModel and custom data stored in a meta object.
Bookmarks