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

Erik Hvatum ice.rikh at gmail.com
Tue Mar 17 17:05:34 GMT 2015


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).

Cheers,
Erik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.py
Type: text/x-python
Size: 1010 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150317/5bd97933/attachment.py>


More information about the PyQt mailing list