[PyQt] QGraphicsScene/Item/View coordinates

Frédéric frederic.mantegazza at gbiloba.org
Fri Jan 23 22:24:45 GMT 2009


Hi,

I would like to use QGraphicsXxx objects to create a widget which displays 
all pictures the motorized panohead will shoot, like this (done in PyGTK):

http://trac.gbiloba.org/papywizard/attachment/wiki/ScreenShots/shootDialog_mosaic_pc.png

I'm sure there is a simple way to avoid all computations I had to do with 
PyGTK, but I'm not yet familiar with this framework.

1) Is it possible to define my scene so its coordinates fit my shooting 
field of view? For example, if the user selects horizontal fov as [-90°, 
90°], and vertical fov as [-45°, 45°], should I instanciate the 
QGraphicsScene like this:

    QGraphicsScene(-90, -45, 180, 90)

so if I add an item (say a rectangle) created by:

    QGraphicsRectItem(-10, 10, 20, 20)

it will be centered in the scene?

2) I would like the previous scene always entirely visible in its view, 
whatever this view size is. How can I do that? Is it the purpose of the 
fitInView() method?

Thanks,

-- 
    Frédéric

    http://www.gbiloba.org



More information about the PyQt mailing list