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

Ian Wadham iandw.au at gmail.com
Wed Jul 4 05:59:24 UTC 2012


On 01/07/2012, at 8:04 PM, Christian Krippendorf wrote:
> On 01.07.2012 03:06, Ian Wadham wrote:
>> I guess the scaling of QGraphicsPixmapItem is OK for photos, etc., but how
>> do you use it with pixmaps pre-rendered to a certain size?
>> 
>> It seems to me that I have to use the same pixel-based co-ordinates in both
>> the QGraphicsScene and the QGraphicsView and change all the scene item
>> co-ordinates and sizes after every resize of the QGraphicsView (not to mention
>> the size of the whole scene), so that the scale factor for rendered pixmaps is
>> always 1.0.
>> 
>> Or am I missing something?
>> 
>> I am asking because it would be nice if I could use the same co-ordinate
>> system in both the game engine (model) and the QGraphicsScene.
> 
> maybe u also want to have a look on branches/work/krippendorf. On this port of KMahjongg i create my own GameItem derived from QGraphicsItem. It is also represented as a pixmap from svg items.

Thanks very much for this suggestion, Christian. Unfortunately I have not
had time to look at it thoroughly yet, but I would certainly like to.  I think it
might be the simplest approach of all.

Thanks again, Ian W.



More information about the kde-games-devel mailing list