[PyQt] How to catch the Moved Item in a TreeWidget through an Event Filter?

I am trying to catch the TreeWidgetItem that is being moved through a drag and drop operation. When an Item is moved, I want to capture the new parent in the TreeWidget.

So far I have installed an event filter on my Tree and catching the QEvent.ChildRemoved, like so:


    def eventFilter(self, sender, event):
        if event.type() == QtCore.QEvent.ChildRemoved:
            self.updateSomething(sender)
        return False

However, sender is the TreeWidget, not the TreeWidgetItem that moved… When a TreeWidgetItem is moved through a drag and drop operation, how do i capture which object moved?

Thanks…

edit:
So i found the child method on QChildEvent, but it returns a generic QObject instead my custom, sub-classed TreeWidgetItem…
After the drag and drop operation, my subclassed TreeWidgetItem is in it’s new place, but I’m trying to catch it so I ask it for it’s new parent.


    def eventFilter(self, sender, event):
        if event.type() == QtCore.QEvent.ChildRemoved:
            childWidget = event.child()
            self.updateSomething(childWidget)
        return False

I found a workaround, it’s not elegant - but what I ended up doing was capturing the Widget at the beginning of a Drag Event and storing it in a class variable on the UI. When the Drop Event triggers, i call my custom function and retrieve the item widget from the class variable.