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