Is it a bug to use QGraphicsItem with QMultiMediaWidgets?
-
My code below can not run normally. I use Python3.6.5, PyQt5.9.2/PyQt5.11.2.
import QMultiMediaWidgets from PyQt5.QtWidgets import QGraphicsObject, QGraphicsPathItem class MyGraphicsObject(QGraphicsObject): def __init__(self, parent): super(CableLine, self).__init__(parent) self.line = QGraphicsPathItem(self)
MyGraphicsObject is added to the QGraphicsScene. Code above will exit abnormally, process finished with exit code -1073741819 (0xC0000005).
If i comment first line, code run normally.
If i change code:self.line = QGraphicsPathItem(self)
to:
self.line = QGraphicsPathItem() self.line.setParentItem(self)
code also run normally.
What is the reason?
-
Hi and welcome to devnet,
What is the relation with
QMultiMediaWidgets
? -
-
Then show the full code that exhibit that behaviour.
-
Is that specific to only that application or does it happen with other applications you build with PyQt ?
-
@richie18 said in Is it a bug to use QGraphicsItem with QMultiMediaWidgets?:
The program‘s exit code is 0xC0000005
There are many many possible reasons for error code 0xC0000005 (for example, accessing a null pointer). The error code alone doesn't tell us anything useful.
Try to see if you can get any useful info from a debugger. (I don't have experience with debugging Python crashes, sorry)
@richie18 said in Is it a bug to use QGraphicsItem with QMultiMediaWidgets?:
If i comment first line, code run normally.
If i change code:self.line = QGraphicsPathItem(self)
to:
self.line = QGraphicsPathItem() self.line.setParentItem(self)
code also run normally.
I'm guessing the bug is actually in a different part of your code. These lines might be unrelated.