Unsolved How to drag an Image to the widget?
-
Here is part of my code, I set "setAcceptDrops(true)" and use "hasImage()" but it still shows like follows.
Besides, how can I get the filename of the dragged image?
void ImageWidget::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasImage()) { event->acceptProposedAction(); } } void ImageWidget::dropEvent(QDropEvent *event) { QString fileName; /* if (!fileName.isEmpty()) { save_xmlfile = QFileInfo(fileName).fileName(); image_index = save_xmlfile.section(".",0,0); ptr_image->load(fileName); load_status = true; } */ }
-
@Geng.Y
CLOSED (double post)