I was porting the Draggable Icons example to Qt for Python 5.14 and discovered a QPixmap serialization problem. When a QPixmap is written into a data stream, restored, and written again, the resulting data stream is only 4 bytes large. It seems like the restored QPixmap cannot be written into a data stream again.
I've reduced the code to the minimum where the problem can be reproduced. The attached examples (both Python and C++) have the following steps:
- Load a QPixmap from a file
- Serialize the pixmap into a QDataStream
- Restore the pixmap from the QDataStream: at this point, the image is restored correctly, it is rendered correctly as well
- Serialize the restored pixmap into a data stream: at this point, the data stream is only 4 bytes large (I suppose it contains only the data stream format marker)
- Try to restore the pixmap: obviously, nothing can be restored
The very same code works with Qt 5.13, so it appears to be a regression