[Qt-interest] How to update
Samuel Rødal
sroedal at trolltech.com
Thu Jul 2 10:31:45 CEST 2009
Sujan Dasmahapatra wrote:
> -----Original Message-----
> From: Samuel Rødal [mailto:sroedal at trolltech.com]
> Sent: Thursday, July 02, 2009 1:46 PM
> To: Sujan Dasmahapatra
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] How to update
>
> Sujan Dasmahapatra wrote:
>> Dear Friends
>>
>> I have a custom GraphicsItem Geometry class.
>>
>> *Class Geometry:public QGraphicsItem*
>>
>> *{*
>>
>> * Q_OBJECT*
>>
>> *Public:*
>>
>> * Int numberOfPoints;*
>>
>> * QPointF *points;*
>>
>> *};*
>>
>> * *
>>
>> *Geometry *geometry = new Geometry;*
>>
>> *geometry->setPos(dx+geometry->x(),dy+geometry->y());*
>>
>> I do a translation on the geometry by setPos() function so the position
>> of the geometry is changed.How would I update the 'points' with the new
>> coordinate points??? Please tell me someone.
> I want those coordinates.How could I get those coordinates in point array.I want to save the data points.
In that case you should transform the points by the item's scene
transform, but don't do it in-place or the points will be transformed twice.
for (int i = 0; i < numberOfPoints; ++i)
transformedPoints[i] = mapToScene(points[i]);
--
Samuel
More information about the Qt-interest-old
mailing list