PDA

View Full Version : Ellipse and rotation



navi1084
9th March 2009, 08:38
Hi,
I need to draw many shapes in a widget. these shapes are all resizable and rotatable.
My question is how i can create rotatable ellipse. If i rotate the Qpainter object then all the shapes in the widget are rotating. how can i rotate only Ellipse????

Lykurg
9th March 2009, 08:59
xxx::paint()
{
// other items
painter.rotate( x° );
// paint your item which should be rotated
painter.rotate( -x° );
// go on
}

and set the right point/anchor for the rotating.

navi1084
9th March 2009, 09:35
thank You.... it worked :)
But i am facing one more issue because of this... if i rotate the painter, this rotation effects on upcoming shapes. fro ex. if i draw ellipse and next rectangle, then rotating ellipse, rotate the rectangle too...
how i can rsolve this????

Lykurg
9th March 2009, 10:43
You must rotate your painter back as mentioned via "-x°". Or you can use save and restore before and after drawing your rotated item.