[Qt-interest] polyline gets modified after translation
Samuel Rødal
sroedal at trolltech.com
Wed Jun 17 12:38:02 CEST 2009
Sujan Dasmahapatra wrote:
> I draw a graphicsitems polyline which take the arguments as number of
> points and point list. Now after I do a translation on the graphics
> items do the pointlist gets modified ?
>
> My *Geometry* class has members *noOfPoints* and *QPointF *points*;
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> class Geometry:public QGraphicsItem
>
> {
>
> Q_Object
>
> public:
>
> int noOfPoints;
>
> QPointF *points;
>
> };
>
> Now in Geometry class in the paint method I draw the polyline .
>
> Now I do a translation from on this geometry.
>
> /////////////////////////////////////////////////////////////////////////////////////////
>
> Geometry *geometry;
>
> geometry->translate(dx,dy);
>
>
>
> Now after translation would my Geometry class’s *points *get modified
> ??????????
>
> Can I take those points as the new set of coordinates for Geometry.
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> If you don’t understand please ask me.
QGraphicsItem::translate() and the other transformation functions will
just initialize the painter that gets sent to the graphics item's
paint() method with a different world transformation.
--
Samuel
More information about the Qt-interest-old
mailing list