Polygon creation like gimp free select
jakir last edited by
I am working on a desktop application using subclassed QGraphicsView/Scene and -Items for showing an image and various overlay graphics.
In the application, the user needs to be able to draw a closed polygon, as it is e.g. done in Gimp select lasso tool and other drawing applications. Basically the user initially clicks in the scene marking the first vertex. Following this a line is drawn between the first vertex and the mouse cursor points. New clicks adds new vertices. While still in drawing mode the user can select previously added vertices and move them around (not translating the entire polygon) and finally close the polygon by adding a connection to initial vertex.
What would be the QT-way of implementing this? If have looked at the elasticnodes example in the qt examples, and it could be a way forward, i.e. creating a custom QGraphicsItem for the vertices and another custom QGraphicsItem for the edges. Is this the way to go or is there a better/simpler approach?
Any input much appreciated!
guanyu Banned last edited by
This post is deleted!