I think QDrag::cancel() works only on drag operations created internally by Qt, not on drag operations started in your own application code. An example of this might be reordering the rows / columns in a table widget when a "movable" property is set.
If the QDrag instance is your own, then you can try calling deleteLater() using its pointer. If that doesn't work, then maybe you will have to redesign your interaction so this problem can't occur.
In my experience, if you start a drag operation and then click the ESC key, this will cancel the drag. I would think that this same interaction mode is supported in Qt. So you could also try posting a QKeyEvent to the QDrag instance to simulate a user key press.




Reply With Quote
Bookmarks