I started dragging and dropping with the image.
QDrag* drag = new(QDrag)(this); drag->setPixmap(*pixmap); drag->exec(Qt::CopyAction | Qt::MoveAction);
I want to change the image display when my movement reaches a certain point in the widgets.
I currently have an idea. After I start the first drag, when my resistance reaches a certain point, I cancel the first drag and then restart the new drag with a new image.
I am doing this in dragMoveEvent . I can start a new drag and drop with a new image. But I can't seem to undo the first drag and drop. I believe the previous drag and drop action is still in progress.
Anyone can offer:
if (event->mimeData()->hasText()) { if (need_to_change_pixmap()) { event->setDropAction(Qt::IgnoreAction); change_pixmap_restart_drag(); } else { event->setDropAction(Qt::MoveAction); event->accept(); } } else { event->ignore(); }
The change_pixmap_restart_drag function just starts to drag.
source share