Change icon of a drag and drop event
-
Currently, the only drag and drop place where the icon of a drag action is configurable is when the drag event is "manually created":http://qt-project.org/doc/qt-5/qtwidgets-draganddrop-draggableicons-example.html:
@
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(pixmap);
drag->setHotSpot(event->pos() - child->pos());
@Here:
@
drag->setPixmap(pixmap);
@changes the icon of the drag action. But in the case of an externally provoked drag event:
@
QWidget::dragEnterEvent(QDragEnterEvent *event)
@it is not possible to change the icon of the drag action.
I want to drag a file to my application and as the mouse cursor enters the application window's area, I want to change the icon of the drag action. Then if the user doesn't drop the file onto the application window but moves it out of its area, I want to recover the original icon.