Trying to construct a QImage
with byte data along with a cleanupFunction
, am I doing something wrong here?
Segfault code:
>>> from PySide6 import QtGui as qtg
>>> qtg.QImage(b'', 10, 10, qtg.QImage.Format.Format_ARGB32, lambda: print(x))
[1] 119240 segmentation fault python3
but without the function it works:
>>> qtg.QImage(b'', 10, 10, qtg.QImage.Format.Format_ARGB32)
<PySide6.QtGui.QImage(QSize(10, 10),format=QImage::Format_ARGB32,depth=32,devicePixelRatio=1,bytesPerLine=40,sizeInBytes=400) at 0x7fc7af514fc0>
In accordance to the PySide documentation for the constructor, I changed the first argument to a string, but that didn't work:
>>> qtg.QImage('', 10, 10, qtg.QImage.Format.Format_ARGB32, lambda: print(1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'PySide6.QtGui.QImage.__init__' called with wrong argument types:
PySide6.QtGui.QImage.__init__(str, int, int, Format, function)
Supported signatures:
PySide6.QtGui.QImage.__init__()
PySide6.QtGui.QImage.__init__(str, int, int, PySide6.QtGui.QImage.Format)
PySide6.QtGui.QImage.__init__(str, int, int, int, PySide6.QtGui.QImage.Format)
PySide6.QtGui.QImage.__init__(Union[PySide6.QtGui.QImage, str])
PySide6.QtGui.QImage.__init__(bytes, int, int, int, PySide6.QtGui.QImage.Format, Optional[Callable] = None, Optional[int] = None)
PySide6.QtGui.QImage.__init__(bytes, int, int, PySide6.QtGui.QImage.Format, Optional[Callable] = None, Optional[int] = None)
PySide6.QtGui.QImage.__init__(Union[str, bytes, os.PathLike], Optional[bytes] = None)
PySide6.QtGui.QImage.__init__(PySide6.QtCore.QSize, PySide6.QtGui.QImage.Format)
PySide6.QtGui.QImage.__init__(int, int, PySide6.QtGui.QImage.Format)
PySide6.QtGui.QImage.__init__(Iterable)
further more, the list of function signatures shows that it's supposed to be a bytes object.
(Also, is it just me or is PySide's documentation really bad?)