[PyQt] itemChange vs reparent vs pyqtSlot

Phil Thompson phil at riverbankcomputing.com
Mon Aug 15 22:34:36 BST 2016


On 15 Aug 2016, at 9:13 pm, oliver <oliver.schoenborn at gmail.com> wrote:
> 
> We need to reparent a graphics item to another. My colleague came across the weirdest bug: just decorating a function with pyqtSlot(QPushButton) causes QGraphicsItem.itemChange() to fail reparenting (reparentItem()). Just run the following example with stock PyQt 5.5.1 (downloaded from riverbank website in binary form) and observe the output: 

> If anyone can try this in PyQt 5.7 and let us know if the bug is gone, that would be good enough since upgrading to that version is on our short-term roadmap. 
> 
> If the bug is still in latest 5.7 binary release, I'm really hoping someone can suggest a workaround that would allow us to continue to use itemChange, setParentItem and QPushButton or QGraphicsItem as arg to pyqtSlot decorator.

Works for me PyQt v5.7.

Phil


More information about the PyQt mailing list