What is happening is the following issue:
I finally got the answer to my problem.
"Flag" on the view:
self.setAcceptDrops(True)
VIEW :
def dragEnterEvent(self, q_graphics_scene_drag_drop_event):
q_graphics_scene_drag_drop_event.accept()
q_graphics_scene_drag_drop_event.acceptProposedAction()
try:
if q_graphics_scene_drag_drop_event.mimeData().hasUrls():
print("local chrome")
url = str(q_graphics_scene_drag_drop_event.mimeData().urls()[0].url())
NAM_CREATOR.get_nam().request_image(url)
else:
print("webview")
html = q_graphics_scene_drag_drop_event.mimeData().html()
matches = re.search('src="([^"]+)"', html)
url = matches.group()[5:-1]
NAM_CREATOR.get_nam().request_image(url)
except RuntimeError:
print('error',sys.exc_info())
pass
super(ScreenViewScene, self).dragEnterEvent(
q_graphics_scene_drag_drop_event)
def dragMoveEvent(self, QDragMoveEvent):
QDragMoveEvent.accept()
super(ScreenViewScene, self).dragMoveEvent(QDragMoveEvent)
def dropEvent(self, event):
print("LEAVE")
image = QPixmap("resources/browser_images/image_required_browser")
self.graphics_image = QGraphicsPixmapItem(image)
self.graphics_image.acceptDrops()
self.graphics_image.setFlags(QGraphicsItem.ItemIsSelectable)
self.graphics_image.setFlags(QGraphicsItem.ItemIsMovable)
self.scene.addItem(self.graphics_image)
self.graphics_image.setPos(event.pos())
NAM_CREATOR.get_nam().deleteLater()
NAM_CREATOR.reset_nam()
super(ScreenViewScene, self).dropEvent(event)
Scene:
def dragEnterEvent(self, QGraphicsSceneDragDropEvent):
QGraphicsSceneDragDropEvent.accept()
def dragMoveEvent(self, QGraphicsSceneDragDropEvent):
QGraphicsSceneDragDropEvent.accept()