[Kde-games-devel] Chess game for KDE4

Parker Coates parker.coates at gmail.com
Fri Dec 4 23:57:39 CET 2009


On Fri, Dec 4, 2009 at 17:09, Miha Čančula wrote:
> In my example, QGV is actually faster than KGC because:
>  - the scene is separated from the view, so it doesn't have to be redrawn on
> every resize (or maybe I was just using it wrong)

If you're talking about having a sceneRect that's a different size
than the QGraphicsView widget, yes, you can do that, but the result
doesn't look very good. You lose pixel perfection.

>  - there is QGraphicsSvgItem, which is a quite nice considering KDE Games
> themes are mostly svg files.

Despite it seeming attractive, you really don't want to use
QGraphicsSvgItem. Rendering SVG is expensive and you're going to want
full control of when and how that happens. Almost all the QGV based
games use QGraphicsPixmapItems that get their pixmaps from a renderer
class that uses QSvgRenderer and KPixmapCache internally. While not
quite trivial, it seems to be working out quite well for us. Look
around, there are plenty of examples.

Parker


More information about the kde-games-devel mailing list