[PyQt] SOLVED Dragging a QGraphicsItem from a QListView

Mads kofoden at yahoo.com
Wed Jun 17 14:03:44 BST 2009


I forgot to have a reference to the scene...

Thanks



________________________________
From: Mads <kofoden at yahoo.com>
To: pyqt at riverbankcomputing.com
Sent: Tuesday, June 16, 2009 4:46:27 PM
Subject: Re: [PyQt] Dragging a QGraphicsItem from a QListView


I forgot to add the right code.


I have attached the drag and drop events of the graphicsview and the list. Executing this code I don't get any errors, but nothing is shown on screen. I hope someone can explain what I'm doing wrong.

Mads



________________________________
From: Mads <kofoden at yahoo.com>
To: pyqt at riverbankcomputing.com
Sent: Tuesday, June 16, 2009 2:09:00 PM
Subject: [PyQt] Dragging a QGraphicsItem from a QListView


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/20090617/d858ddd4/attachment.html


More information about the PyQt mailing list