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:

Qt Code:
  1. QPixmap* myObject::preview()
  2. {
  3. QPixmap* image = new QPixmap(boundingRect().size().toSize());
  4. image->fill(QColor());
  5. QPainter imagePainter(image);
  6. imagePainter.translate(-boundingRect().topLeft());
  7.  
  8. paint(&imagePainter, 0, 0);
  9.  
  10. imagePainter.end();
  11.  
  12. return image;
  13. }
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