jonks
12th July 2009, 04:40
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:
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;
}
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-interest/2007-01/thread00089-0.html
Any ideas?
Thanks
Jonks
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:
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;
}
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-interest/2007-01/thread00089-0.html
Any ideas?
Thanks
Jonks