PDA

View Full Version : NOT zooming childs after parent zoom.



alitoh
19th April 2011, 15:37
I can't figure out how to make childs NOT zoom in when I zoom in a parent object.

The reason I need this is for something like a crossplot. If I zoom out enough, I see all the points in the crossplot, but if I zoom in, I don't want to see only one gigant point (actually, it is a QRectF, but theoretically a point) but, instead, I want to see a point the same size it originally was, only that the zoom made the whole thing scale and it's alone in the view frame.


I don't know if this is clear enough, but picture this: You see a ball pool. each ball is a dot in the pool (plane, scene) and, as I zoom in, I start seeing less and less balls, until I either see a single dot in the center or just a blank space (because the zoom is so big that a minimal distance between two balls is now a huge one. The ball I see in this zoom is still the same size it was on the normal zoom, just that it's scale in relation to the whole scene changed. You could say it is, now, more precise in relation with it's theoreticall point in space value (due to a smaller scale).

Incidentally, I just might be doing it all wrong and I;m confusing scalling with zooming.

thanks for your help.

wysota
19th April 2011, 15:41
Assuming you are using Graphics View, set ItemIgnoresTransformations flag on your items which shouldn't zoom with their parents.

alitoh
19th April 2011, 15:48
Ah, yes. Sorry about that.

I am, indeed, using GraphicsView.

If I were to use the Ignores Transformation flag, wouldn-t it ignore the parent transformation? That is, I need the parent's scale system to properly position each point in the plane, wouldn't that make the object ignore EVERYTHING that's going on? I think what I need is something along the lines of descalling-zoomingout in direct relation of how I scalled-zoomed in the parent.

Correct me if I'm wrong, tho.

thanks in advance.

wysota
19th April 2011, 16:07
If I were to use the Ignores Transformation flag, wouldn-t it ignore the parent transformation?
If you mean the position of an item relative to its parent then no. If you mean anything related to scaling or rotating the parent then yes.

alitoh
19th April 2011, 16:12
If you mean the position of an item relative to its parent then no. If you mean anything related to scaling or rotating the parent then yes.

Wouldn't zoom cound as a scalling? That is, if I were to zoom the parent object, wouldn't the "unit" that the child object uses to draw itself change too? Say that at 1:1 zoom you have a child at (30,55), which is in the local, parent's unit system. Would that scalling remain for the child if I zoom the object? (like, if I were to zoom in, the redraw would move the childs closer to the parent's (0,0) because that scale would be different than before?)

wysota
19th April 2011, 16:27
Wouldn't zoom cound as a scalling?
Yes. And I understand you wish your child item to not zoom when the parent zooms so it fits the usecase.


That is, if I were to zoom the parent object, wouldn't the "unit" that the child object uses to draw itself change too?
No. That's the whole point of ItemIgnoresTransformations.

Say that at 1:1 zoom you have a child at (30,55), which is in the local, parent's unit system. Would that scalling remain for the child if I zoom the object?
The child would still be at (30,55) of the parent's coordinate system and it would remain the same size (so its scale relative to the parent would change).
This is usually used for implementing labels for objects, we usually do not want to scale those if the items they describe scale.