[Qt-interest] How to update
Sven Grunewaldt
strayer at olle-orks.org
Thu Jul 2 09:40:40 CEST 2009
Am 02.07.2009 09:32, schrieb Sujan Dasmahapatra:
>
> 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.
>
> Kind regards,
> LM Glasfiber R&D (India) Pvt. Ltd.
>
> Sujan Dasmahapatra
> Project Engineer - CFD
>
> Telephone: +91 80 66470248
> Mobile:
> E-mail: sdh at lmglasfiber.com <mailto:sdh at lmglasfiber.com>
>
> --------------------------------------------------------------
>
> This e-mail and any attachments are confidential. If you are not the
> named or intended recipient, please notify the sender immediately and
> do not disclose the contents to any other person, use it for any
> purpose or store or copy the information in any medium. Any
> unauthorized disclosure, use or storage is prohibited and might be
> unlawful.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
Why don't you just use pos() from QGraphicsItem?
If you really need your own QPointF just write a wrapper function...
void Geometry::mySetPos(qreal x, qreal y)
{
setPos(x, y);
points->setX(x);
points->setY(y);
}
Regards,
Sven Grunewaldt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090702/39736083/attachment.html
More information about the Qt-interest-old
mailing list