I'm working on a custom widget, subclassed from QAbstractScrollArea. This is with Qt 4.5.2 on Linux.

I want to be able to drag and drop within the widget and between widgets (all sources and targets are the same custom class). My code is working... sometimes. It looks like dragEnterEvent is called some of the time, but not always. And sometimes, dragEnterEvent is immediately followed by dragLeaveEvent (while the mouse is still in the widget).

Once I get a dragEnterEvent, everything works perfectly. If I don't get a dragEnterEvent, then of course dropEvent is never called, and the drag-and-drop operation fails.

If I move the mouse out of the window, and back into it, and repeat that a bunch of times, I eventually get a dragEnterEvent, and it works. (I have debug printfs in all of the event functions right now so I can see what's happening.)

I'm calling setAcceptDrops(true), and all of the drag*Event functions are calling accept(). And it does work correctly sometimes.

Has anyone seen anything like this before?