<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">I forgot to have a reference to the scene...<br><br>Thanks<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Mads <kofoden@yahoo.com><br><b><span style="font-weight: bold;">To:</span></b> pyqt@riverbankcomputing.com<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, June 16, 2009 4:46:27 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [PyQt] Dragging a QGraphicsItem from a QListView<br></font><br>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">I forgot to add the right code.<br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br>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.<br><br>Mads<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Mads <kofoden@yahoo.com><br><b><span style="font-weight: bold;">To:</span></b> pyqt@riverbankcomputing.com<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, June 16, 2009 2:09:00 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [PyQt] Dragging a QGraphicsItem
from a QListView<br></font><br>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hi list<br><br>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?<br><br>I have implemented this dropevent in the graphicsview:<br><br> def dropEvent(self, event):<br> node = item.Item(event.pos(), self.scene)<br> node.show()<br> event.accept()<br><br>it is being called and calls the graphicsitem, but it is not shown on screen.<br><br>What am I doing
wrong?<br><br>Mads<br><div><br></div></div><br>
</div></div></div><br>
</div></div></div><br>
</body></html>