Hello all,

I am having a bit of trouble with my QT Drag and Drop events. I am dragging 
an item from a QTableWidget (uiNodeUnit) and dropping it onto a QTreeWidget 
(uiUnitTree)

I have managed to set up an event filter on the QTreeWidget and when the 
item is dropped the event is fired. However I am struggling to return the 
name of the item that has been dragged in, I have looked into startDrag and 
mime data but no luck on my end so far. Is there some method that I am 
missing.

One extra thing, when I print source.objectName() the value is very odd 
indeed. The value I get returned is: qt_scrollarea_viewport should it be 
one of my widgets or have I set it up incorrectly?

Cheers,

Ben

My code is as follows:

12345678910111213

                # Inside the __init__ function
                self.uiMainWindow.uiNodeUnit.setDragEnabled(True)
 
                self.uiMainWindow.uiUnitTree.setDropIndicatorShown(True)
                self.uiMainWindow.uiUnitTree.setAcceptDrops(True)
                self.uiMainWindow.uiUnitTree.setDragEnabled(True)
                self.uiMainWindow.uiUnitTree.viewport().installEventFilter(self)
 
        def eventFilter(self, source, event):
                #print source.objectName()
                if (event.type() == QtCore.QEvent.Drop):
                        print "Event Filter"
                return QtGui.QMainWindow.eventFilter(self, source, event)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/d689de76-6699-41db-a808-8e3eca1fce5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to