Re: segfault with multiple inheritance and QGraphicsItems
Phil Thompson <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
On 02/05/2019 19:07, Zach Pincus wrote: > Thanks! > > You're correct that the crash has nothing to do with the mixin: I > thought I had tested that aspect carefully, but apparently not. (My > apologies; it's a long story :) Furthermore, as you suggested, > importing QtWidgets instead of Qt solves the problem. > > ## THIS CRASHES ## > from PyQt5 import Qt > class MyItem(Qt.QGraphicsRectItem): > def itemChange(self, change, value): > return value > myitem = MyItem() > rect = Qt.QGraphicsRectItem(parent=myitem) > > ## THIS DOES NOT CRASH ## > from PyQt5 import QtWidgets > class MyItem(QtWidgets.QGraphicsRectItem): > def itemChange(self, change, value): > return value > myitem = MyItem() > rect = QtWidgets.QGraphicsRectItem(parent=myitem) > > Is there a way to work around this issue (other than not importing > Qt)? I originally found this in a fairly large PyQt5 program that we > wrote and use extensively in my lab, and for which not importing Qt > would be a bit of a problem. Since the program is deployed on lots of > machines in the lab, we rely on the PyPI PyQt5 packages. So if there's > an easy workaround we'll use it; otherwise I'll disable the offending > feature until the next release of PyQt5 hits PyPI. > > Thanks a ton for checking this out! > Zach The only workaround I can think of is to remove the QtMultimediaWidgets module. I wish I had never implemented the Qt module (it certainly won't be in PyQt6). Phil _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt