So, I draw a QPolygonF in an area which I define. The area inherits from QGraphicsView.
What I want to be able to do is let user move around the control points of QPolygonF and alter the polygon even after it has been created. I couldn't really find references to how I could do this.
Since I draw lines to close and denote the polygon, and there can me a lot more things in the drawable area, clearing it and drawing it over and over doesn't seem right.
Does anyone know how I could solve this ?
Thanks !
I'm a little confused as to why you describe that your 'area' inherits from QGraphicsView, but then discuss QPolygonF. If you're using QGraphicsView, that implies that you have a QGraphicsScene and would be using QGraphicsPolygonItem.
However, with the assumption that the QGraphicsView is irrelevant here, QPolygonF is simply a class that inherits from a vector of points; QVector.
You should be able to iterate through the points and just move them wherever you want. You can get a point like this: -
Then you can move the point: -
Redrawing the item as a point is moved should not be a problem.