PDA

View Full Version : Problem with rotation of QGraphicsItem



ashishsaryar
10th July 2008, 14:40
hi

to all


I have a problem related to rotation of QGraphicsItem.

I m using the rotate() to rotate the QGraphicsItem ...

but after rotating the bounding rect of QGraphicsItem is increasing ..

Pls tell me the reason of this and pls tell me how can i protect it..

Ashish

Sandip
10th July 2008, 15:03
Hi,

It's true that if you will rotate the graphics item then it's bounding rectangle will change.
It's a correct behavior. You will come to know if you will draw one rectangle inside your graphics item.

When item is rotated, it changes it's bounding rect to accomdate the complete item inside it.

Please try with polygon.

caduel
10th July 2008, 15:03
if the rectangle is rotated, a QRect (which is always parallel to the axes) needs to be larger to contain it. Just draw it on a piece of paper and you will see.

There is no way around that.
Perhaps you can use shape() instead?