[PyQt] Import of PyQt5.QtMultimediaWidgets borks QGraphicsObject wrappers

Ales Erjavec ales.erjavec324 at gmail.com
Thu Feb 4 09:27:02 GMT 2016


Hello,

There seems to be a weird bug in PyQt5 w.r.t wrapping instances of
QGraphicsObject subtypes, after importing QtMultimediaWidgets module

The following code demonstrates this:


from PyQt5 import QtCore, QtWidgets

class Item(QtWidgets.QGraphicsObject):
    pass

item = Item()
itemparent = Item(objectName="abcd")
item.setParentItem(itemparent)
print(item.parentItem())
#->  <__main__.Item object at ...>
# so far so good

import PyQt5.QtMultimediaWidgets

print(item.parentItem())
#-> <PyQt5.QtMultimediaWidgets.QGraphicsVideoItem object at ...>
# not so good
print(item.parentItem().objectName())
#-> abcd



Note that the itemparent variable's type remains untouched.
But whenever it crosses the Qt5->PyQt5 boundary it is wrapped in a
wrong type.

Tested on:
    * OSX, Python 3.5, PyQt 5.5.1 (homebrew installed)
    * Debian, Python 3.4.2, PyQt 5.3.2


Aleš Erjavec


More information about the PyQt mailing list