[Qt-interest] polyline gets modified after translation

Sujan Dasmahapatra sdh at lmglasfiber.com
Wed Jun 17 12:40:28 CEST 2009


Thanks for the help srdjan.

Kind Regards,
Sujan Dasmahapatra

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Srdjan Todorovic
Sent: Wednesday, June 17, 2009 3:34 PM
To: qt-interest
Subject: Re: [Qt-interest] polyline gets modified after translation

Hi,

On 17/06/2009, Sujan Dasmahapatra <sdh at lmglasfiber.com> 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 ?

Depends...

> 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);

The translate() method does not seem to even use 'points', so I don't
think translate() will change it.

I did not look at the documentation, but from your code, translate()
will be on the QGraphicsItem, which is nothing to do with your
Geometry::points.

But it may be the case that you call some method on your Geometry
object that sets the mapping between the QGraphicsItem and your points
pointer, in which case QGraphicsItem may indeed take ownership and
modify the points...

Srdjan
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list