Hi,
I'm trying to create an off-screen render of a QGraphicsItem before the application main window is shown.
My code that creates the is like this:
{
imagePainter.translate(-boundingRect().topLeft());
paint(&imagePainter, 0, 0);
imagePainter.end();
return image;
}
QPixmap* myObject::preview()
{
QPixmap* image = new QPixmap(boundingRect().size().toSize());
image->fill(QColor());
QPainter imagePainter(image);
imagePainter.translate(-boundingRect().topLeft());
paint(&imagePainter, 0, 0);
imagePainter.end();
return image;
}
To copy to clipboard, switch view to plain text mode
I'm getting this error, which I cannot find documentation for:
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::end: Painter not active, aborted
A thread from back in 2007 seems to suggest that the code above should work.
http://lists.trolltech.com/qt-intere...ad00089-0.html
Any ideas?
Thanks
Jonks
Bookmarks