Well, I found that I am using a very rare case for QPixmap. It seems the QPixmap cache uses a key based on the filename and timestamp (from QFileinfo). Because I was writing to the same filename within the same second, the key was the same, so QPixmap assumed the file is already in the cache and didn't bother loading the file again.
The annoying part is that QTemporaryFile (calls mktemp() on windows) will reuse the same filename if you create one and delete it and then create another one. So while QTemporaryFile does guarantee that the filename is unique on the filesystem, it doesn't guarantee that the filename is unique on the filesystem *over time*.
So, instead, I just keep the temp files around till I'm all done; at least this guarantees that I write to a different unique file so QPixmap doesn't assume it's in the cache. Not the best or elegant solution, but just the easiest way to get around it. I'd rather not have to roll my own QTemporaryFile.




Reply With Quote


Bookmarks