I used memset because I was planning on changing the contents of the raw data and hoping that I could do this after the call to the QImage constructor.
Apparently this is not possible.
Ah, no, that is indeed possible. Passing memory to the QImage constructor makes it use that memory, not a copy.
Alternatively you could let QImage create the memory and then access it via QImage::bits() or QImage::scanline().
Bookmarks