[Kde-games-devel] KGoldrunner problem in Windows

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Mon Dec 24 12:44:58 CET 2007


Ian Wadham schrieb:
<snip>
> I thought it might be because the QPainter and QImage are used
> and re-used repeatedly, in a loop.  Your begin() and end() are inside
> the loop, essentially giving you a fresh QPainter each time.  But no,
> KJumpingCube also uses a loop with no begin() or end().  So I am
> puzzled by this.
> 
Thx, kjumpingcube was also wrong.
It looks like it works when it's not inside a loop - e.g.

QPainter p(img);
p.doSomething();
QPixmap p = QPixmap::fromImage(img);

works fine but with

QPainter p(img);
for(int i = 0; i < 2; i++){
  p.doSomething();
  QPixmap p = QPixmap::fromImage(img);
}

only the first pixmap is correct. QPainter::end() flushes all internal
buffers and therefore it's needed to make sure all is painted before
accessing a QImage/QPaintDevice.

I'm now looking to all kde games to see if there're other places where
QPainter is used wrong. katomic (e.g. katomicrenderer.cpp) is correct.

HTH
Christian






More information about the Kde-windows mailing list