[Qt-interest] Rotation of a graphicsItem

Shashank Singh shashank.personal at gmail.com
Mon Jun 29 16:54:54 CEST 2009


hi
if it's only one item in scene ,you rotate the view itslef,,you will get the
same effect

On Mon, Jun 29, 2009 at 7:21 PM, Sean Harmer <
sean.harmer at maps-technology.com> wrote:

> Hi,
>
> On Monday 29 Jun 2009 10:21:49 Sujan Dasmahapatra wrote:
> > Dear Friends
> >
> > For rotating a graphicsitem about an  arbitrary point(x,y)
> >
> > I am doing like this
> >
> > geometry->translate(xc,yc);
> > geometry->rotate(angle);
> > geometry->translate(-xc,-yc);
> >
> > but its rotating about the point on the graphicsitem itself I want to
> > roate it with respect to view coordinate system.what I am doing wrong
> > here.
> You need to map the coordinates of the point in the scene coord system
> about
> which you wish to rotate into local item coordinates. for e.g.
>
> // Centre of rotation in scene coords
> QPointF centreScene( 0.0, 0.0 );
>
> // Centre of rotation in item coords
> QPointF centreItem = mapFromScene( centreScene );
>
> // Do the translate, rotate, rtanslate back again thing
> translate( centreItem.x(), centreItem.y() );
> rotate( angle );
> translate( -centreItem.x(), -centreItem.y() );
>
> HTH,
>
> Sean
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
Regards:
Shashank Singh
Associate - Software | New Technologies team
Geodesic Limited |  <http://www.geodesic.com>
Tel: +91 22 2831 2872

Blog:http://techfreaks4u.com/blog
Marble contributor : http://edu.kde.org/marble/
KDE-in Volunteer : http://www.kde.in/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090629/38d681f1/attachment.html 


More information about the Qt-interest-old mailing list