PDA

View Full Version : Fixed Position of QGraphicsItem



moh.gup@gmail.com
21st January 2012, 05:44
Hi,

How can i set fixed position of a graphicsitem which should not be change on changing scene rect or on any applying any transformation(rotate,shear etc) on view.
I already applied flag ItemsIgonreTransformation. and change postion when scenerect change signal emmited.But i am not able to get any signal of transformation.
I want some items(seem to) same position .example Zoomingbar in any map shouldn't change postion ,when map get rotated or transformed.

Please Suggest.

Thanks

wysota
21st January 2012, 08:49
An option is to not make those static pieces items. Another option is to use QGraphicsItem::itemChange() to be notified of item position changing and move the item back where it should be.

moh.gup@gmail.com
21st January 2012, 12:16
Hi,
Thanks for Reply,I tried QGraphicsItem::itemChange() but on applying transformation on view,QGraphicsitem didnt get any notification.
Please let me know If there is any flag which make me avilable tranformation change in view.

Thanks

wysota
21st January 2012, 12:31
Did you read the docs carefully?

moh.gup@gmail.com
21st January 2012, 12:50
sir,
I tried to read docs carefully and also implement it.
Please let me know,If I miss something.

Thanks

wysota
21st January 2012, 13:10
So which GraphicsItemChange would you expect to receive in your situation?

moh.gup@gmail.com
21st January 2012, 13:27
sir,
I am rotating view using QGraphicsView::rotate().I want a single QGraphicsItem seems to be static,I already setFlag(QGraphicsItem::ItemIgnoresTransformations) .
Please suggest.

wysota
21st January 2012, 13:42
Answer my question please. Which GraphicsItemChange would you expect to receive. Because without knowing that how can you enable the right one? If there is any "right one". Honestly I would rather use my other solution -- make your "other stuff" something else than items.

moh.gup@gmail.com
21st January 2012, 13:58
Sir,
I except to receive QGraphicsItem::ItemTransformHasChanged but on changing Tranformation of view I am not getting it.Is it possible?

wysota
21st January 2012, 14:42
I except to receive QGraphicsItem::ItemTransformHasChanged but on changing Tranformation of view I am not getting it.Is it possible?
To quote the docs:


The item's transformation matrix has changed either because setTransform is called, or one of the transformation properties is changed.
Item's, not view's. This is not what you're looking for. Either find something else or use a different approach.

moh.gup@gmail.com
21st January 2012, 16:27
Thanks I thinks i need to use different apporach