There are a few things you need:
- Override pg.GraphicsView.dragEnterEvent() to accept the event.
- Call pg.PlotItem.setAcceptDrops(True)
- Override pg.PlotItem.dropEvent() to handle the drop
You can override methods either by creating a subclass or by simply re-assigning the method on an existing object. Example:
import pyqtgraph as pg
app = pg.QtGui.QApplication([])
l = pg.QtGui.QListWidget()
l.addItem('Drag me')
l.setDragDropMode(l.DragOnly)
l.show()
win = pg.GraphicsWindow()
win.show()
def dragEnterEvent(ev):
ev.accept()
win.dragEnterEvent = dragEnterEvent
plot = pg.PlotItem()
plot.setAcceptDrops(True)
win.addItem(plot)
def dropEvent(event):
print "Got drop!"
plot.dropEvent = dropEvent