[Kde-games-devel] Co-ordinates in QGraphicsView

Roney Gomes roney477 at gmail.com
Sun Jul 1 01:39:27 UTC 2012


On Sat, Jun 30, 2012 at 10:06 PM, Ian Wadham <iandw.au at gmail.com> wrote:
> So I find out what size the QGraphicsView is in pixels (e.g. 400x400) and I
> divide by 10 to get the grid-square size and ask KGameRenderer to provide
> me a pixmap item (actually KGameRenderedItem) of the right size (i.e. 40x40),
> but now the pixmap gets scaled up when it is painted on the view and it is
> horribly pixellated.

I think it's here where you're failing. You don't have to ask for a
new pixmap in terms of the view's dimensions, but in terms of the
scene's dimensions instead.

It doesn't matter whether the view is 400x400 large, the only things
that matter, from the point of view of a top level QGraphicsItem, are
the scene's dimensions. So, to make things easier in the games I've
been working, I always make the scene's rectangle coincide with the
view's geometry.

Have you tried this approach?


More information about the kde-games-devel mailing list