def dragMoveEvent(self, event: QGraphicsSceneDragDropEvent): event.accept()
def dragEnterEvent(self, event: QGraphicsSceneDragDropEvent): event.accept()
def dragMoveEvent(self, event: QGraphicsSceneDragDropEvent): if any(item.acceptDrops() for item in self.items(event.scenePos())): super().dragMoveEvent(event) else: event.setAccepted(True)
def send_mime(event: QGraphicsSceneDragDropEvent, mimetype: str, obj): qb = QByteArray(pkl.dumps(obj, protocol=pkl.HIGHEST_PROTOCOL)) event.setData(mimetype, qb)
def dragLeaveEvent(self, event: QGraphicsSceneDragDropEvent): self._dragging = False event.setAccepted(False)