[PyQt] QGraphicsItem.childItems() returns objects of wrong type

Phil Thompson phil at riverbankcomputing.com
Tue Mar 17 17:14:36 GMT 2015

On 17/03/2015 5:05 pm, Erik Hvatum wrote:
> Test case attached.
> Execution transcript:
> [11:53 AM][ehvatum at pincuslab-scope:~/zplrepo/ris_widget]> dpython t.py
> QML debugging is enabled. Only use this in a safe environment.
> type(child): <class '__main__.Child'>, child.objectName(): Hi!  I am
> an instance of Child!
> type(parent.childItems()[0]): <class
> 'PyQt5.QtMultimediaWidgets.QGraphicsVideoItem'>,
> parent.childItems()[0].objectName(): Hi!  I am an instance of Child!
> I expected parent.childItems()[0] to be a Child, not a
> PyQt5.QtMultimediaWidgets.QGraphicsVideoItem.
> I see this on Linux with PyQt-gpl-5.4.2-snapshot-3fd70eec66b9 and OS X
> with an older PyQt5 release (haven't tested this on other platforms).



More information about the PyQt mailing list