You are not logged in.

1

Friday, October 5th 2007, 10:55am

Scaling QGraphicsPolygonItem

Hi all,

I have a QGraphicsScene, in which i put a QGraphicsPolygonItem, i want to scale this polygon on user input (spinbox) and i want the polygon in the same position. The problem is when i use the method scale(x, y) the item change its position in the view, but when I print its coordinates remain the same, also the boundingBox is the same.

Can anyone help me?

Luca.

2

Friday, October 5th 2007, 2:04pm

RE: Scaling QGraphicsPolygonItem

Ok. Resolved.

But now I have onother question: in the scene there's a triangle, I want that when the user click on it and hold down the left mouse button, he can move the triangle in the scene.

There's a way to do this?

Thamks,
Luca.

3

Friday, October 5th 2007, 3:04pm

RE: Scaling QGraphicsPolygonItem

Read the documentation.

Quoted

void QGraphicsItem::setFlag ( GraphicsItemFlag flag, bool enabled = true )

If enabled is true, the item flag flag is enabled; otherwise, it is disabled.

See also flags() and setFlags().


Quoted

enum GraphicsItemFlag { ItemIsMovable, ItemIsSelectable, ItemIsFocusable, ItemClipsToShape, ItemClipsChildrenToShape, ItemIgnoresTransformations }
Fighting fire with fire.
Three can keep a secret if two of them are dead.

4

Friday, October 5th 2007, 3:12pm

Oh, I've missed that part!

Thank you.

Luca.

5

Monday, February 11th 2008, 6:18pm

RE: Scaling QGraphicsPolygonItem

How did you solve the problem of changing he position after scaling an item?
I have this problem too!
Thanks!