Hi.
I have a problem saving a QImage.
It is generated from a QGraphicsScene via the following code:
QImage image
(_scene
->sceneRect
().
size().
toSize(),
QImage::Format_RGB32);
_scene->render(&painter);
image.save(filename);
QImage image(_scene->sceneRect().size().toSize(), QImage::Format_RGB32);
QPainter painter(&image);
_scene->render(&painter);
image.save(filename);
To copy to clipboard, switch view to plain text mode
_scene is a QGraphicsScene*
and filename is a non empty string with the format("filename.png")
image.save(filename) always return false.
Another place in my program I save a QImage generated by setting individual pixels in the QImage and that works fine. (The format here is also .png)
I have tried different formats by changing the filename from filename.png to filename.tiff and so on.
Any ideas?
Bookmarks