Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81671

[Reg ->5.14] Repeated QPixmap serialization via QDataStream

    XMLWordPrintable

Details

    • Windows
    • 49b158e07de222473454e2485d981751eb5b5ccf (qt/qtbase/5.14)

    Description

      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:

      1. Load a QPixmap from a file
      2. Serialize the pixmap into a QDataStream
      3. Restore the pixmap from the QDataStream: at this point, the image is restored correctly, it is rendered correctly as well
      4. 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)
      5. 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

      Attachments

        1. main.cpp
          1 kB
        2. main.py
          1 kB
        3. test.png
          test.png
          0.4 kB

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            dpurgin Dmitriy Purgin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: