Details
Description
When trying to create a QPixmap from data as illustrated in the code below:
curQImage = QPixmap.loadFromData(imgDataBytes) # imgDataBytes type is bytes
I get the following error message:
curQImage = QPixmap.loadFromData(imgDataBytes).scaledToWidth( TypeError: descriptor 'loadFromData' requires a 'PySide2.QtGui.QPixmap' object but received a 'bytes'
This doesn't make any sense, why would a QPixmap.loadFromData expect a PySide2.QtGui.QPixmap instead of bytes or a QByteArray ?
See Documentation:
QPixmap Qt 5.11 Documentation
bool | loadFromData(const uchar *data, uint len, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor) |
bool | loadFromData(const QByteArray &data, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor) |
The same code and data works fine with a QImage (which is my workaround for now):
curQImage = ImageFromData.fromData(imgDataBytes)
Thanks.
Attachments
Issue Links
- relates to
-
PYSIDE-849 QVideoFrame bits error
- Closed