Drag and Drop - rejection in dropMimeData
Hi,
I'm on 4.7 and am dropping data onto a subclass of standarditemmodel using dropMimeData; I can identify if I wish to reject the data, but when I do, it is gone from its original location.
I can't stop the item being dragged, as it could go to a valid location. I detect an invalid drop by examining the contents of the item's data (a stored pointer to a class; I use the class type) and that of the target.
How can I reject a drop and either leave the dragged item in place, or put it back where it was?
Many thanks in advance!
Re: Drag and Drop - rejection in dropMimeData
In my opinion you have to do it in the view by intercepting drag and drop events. The current model API does not expose any functions to determine whether a particular drag is going to be accepted by the model or not. I even posted a bug report on it but it was a couple of years ago and then haven't fixed it (so it probably won't ever get fixed, at least not before Qt 6).