Hi,
I have large QGraphicsScene with large number of graphics object on it.
I want to export the scene as image (PNG) it is giving following errors:
Painter::begin: Paint device returned engine == 0, type: 3
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setBrushOrigin: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::opacity: Painter not active
QPainter::worldTransform: Painter not active
CODE:
QImage image
(scene
->sceneRect
().
width(), scene
->sceneRect
().
height(),
QImage::Format_ARGB4444_Premultiplied);
painter.
setRenderHint(QPainter::Antialiasing);
scene->render(&painter);
image.save(sFilePath);
QImage image(scene->sceneRect().width(), scene->sceneRect().height(), QImage::Format_ARGB4444_Premultiplied);
QPainter painter(&image);
painter.setRenderHint(QPainter::Antialiasing);
scene->render(&painter);
image.save(sFilePath);
To copy to clipboard, switch view to plain text mode
But this works fine for the small scene with less no of graphics item on it.
So my queries are-
1. What does it mean by painter not active?
2. How to resolve the above problem?
3. Is it related to scene size and/or no. of graphics items on it?
It would be very helpful for me, if anyone answer the above queries or give any pointers to investigate the issue further.
Thanks!
Bookmarks