[PyQt] Dragging a QGraphicsItem from a QListView

Mads kofoden at yahoo.com
Tue Jun 16 13:09:00 BST 2009


Hi list

I have a mainwindow with a dockwidget which holds a QListView displaying a list of different unique names. Also in the window I have a QGraphicsview. I now want to be able to drag one of the names displayed in the list onto the view, and then be displayed as a QGraphicsItem, which is designed as a rectangle. So the question is how do I get the graphicsview to accept the graphicsitem and then display it?

I have implemented this dropevent in the graphicsview:

  def dropEvent(self, event):
    node = item.Item(event.pos(), self.scene)
    node.show()
    event.accept()

it is being called and calls the graphicsitem, but it is not shown on screen.

What am I doing wrong?

Mads


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090616/9cff3482/attachment.html


More information about the PyQt mailing list