Hi all,

i need to draw a pixmap on a widget which consists about 6 or 7 images.
When I draw directly on the widget in paintEvent, everything is fine.
Now, I want to draw the pixmap once and save it, then, just put it on the widget in paintEvent. However, this does not work correctly.
A snippet of code follows:
Qt Code:
  1. QPainter painter(&pixmap);
  2. painter.drawPixmap(3, 3, pixmapBG);
  3. // and some more commands
  4. painter.end(); // painting done
To copy to clipboard, switch view to plain text mode 
pixmap is a member of my class.

This gives me a message:
QPainter::begin: Paint device returned engine == 0, type: 2

When I use a QPicture instead, it works. QImage also doesn't work.
I don't understand why.
I could use a QPicture for painting and replay it everytime, however, the performance is poor.
Is it possible to convert QPicture to QPixmap? I didn't find anything about that.
I could use play, but then I need to use QPainter painter(&pixmap) again which doesn't work for me.

I use Qt 4.4.0 on WindowsXP and Vista.

Thanks for any hint.

Regards,

Rainer