Hello
I've got following question:
I have a view displaying some progress through a custom delegate subclassed from QStyledItemDelegate. I create a QSlider to edit the progress.
The problem is, that each editor widget has to draw its own background, and has to overdraw the old one. So I set the setAutofill property of the slider to true, and get the result showed in the screenshot (background is one solid colour, but I want it to match the rest of the row).
If I don't set the autofill property the background is not drawn at all, and I can see the progressbar drawn under the slider.
I tried to intercept paint events to the slider and draw the background myself using QStyle()::drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter ), but this doesn't result in good results because I do not have the correct QStyleOptionViewItemV4 object (selection state etc. is not correct, because this is usually set by the view IMHO).
So how can I draw the correct background for the slider without having to filter tons of events to find out the correct state of the item.
Thanks in advance,
Thomas
Bookmarks