[Qt-interest] How to update
Sean Harmer
sean.harmer at maps-technology.com
Thu Jul 2 09:41:46 CEST 2009
Hi,
On Thursday 02 Jul 2009 08:32:16 Sujan Dasmahapatra wrote:
> 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.
You don't need to update the internal position of the points. Your custom item
should just draw them in local item coordinates as always. The QGraphocsView
framework takes care of applying the transformation to your item as a whole.
Please have a read through the docs on QGraphicsView and coordinate systems:
http://doc.qtsoftware.com/4.5/graphicsview.html#the-graphics-view-coordinate-
system
Sean
More information about the Qt-interest-old
mailing list