I’m overloading the paint() function in QAbstractItemDelegate (my own Item delegate class).

When dragging, it paints the contents of the entire cell, which I don’t want. I’m assuming that the paint() function is called with something specific while dragging, but I don’t seem to find it.

The closest I’ve been able to find is a QState variable in the owning view class (access function QTableView::state() is protected.) By creating a function on my QTableView-derived class called ‘isDragging()’ which calls that function and returns whether dragging or no, I can determine within my delegate class whether I’m dragging or not, and can modify the paint() function.

This almost works.

The problem is that it shows the modified paint image in the original cell, which I don’t want – I want to leave the image in the original cell untouched.

Have to scour the examples, I guess, and see if there’s something that does this…

I have crawled through the Qt source and I can see where it sets the drag pixmap by calling the QItemDelegate:aint() function, but the only thing it changes is it forces QStyle::State_Selected in the item option style. That’s not enough, since the item is selected, already.

Any way to know how to draw the drag image without drawing cell contents? And vice versa?

PS: I tried overloading startDrag in my QTableView class and setting my own flag – no change (which makes sense – it’s essentially the same as the DragState…)