PDA

View Full Version : Ignoring scaling graphics view/scale



maverick_pol
7th August 2007, 17:10
Hi guys,

I am currently looking for a solution to set some graphicsitems' position fixed ignoring scaling. Yes I can setFixed size(set item's flag to ignore scaling), but while scaling the coordinates change and the item moves.
I am thinking about reading coordinates from the scene/view and mapping them to widget coordinates and then after resizing I could read the stored coordinates and map them to new coordinates on the scene(so the items would not move).

Do you think it's a good idea?
Or maybe you have different ideas about seeting items ignoring coordinate system. I do not want some items to change their sizes and position, ignore the scaling. THe scene background has to be scaled, but some items shoud be the same during the run-time.


Maverick

Bitto
7th August 2007, 18:44
There's no support in Graphics View for fixating items to the viewport; you could try creating widgets as children of the viewport, and setting FullViewportUpdate to disable widget scrolling : http://doc.trolltech.com/4.3/qgraphicsview.html#ViewportUpdateMode-enum

Otherwise, you can subclass QGraphicsView, reimplement paintEvent() and the other event handlers, and do it all yourself... not recommended though..