I'm trying to implement a "lasso" type rubber band to allow users to select things from a QGraphicsView. A rectangle won't work, because the items don't always fall into a neat rectangular area free from other items.
I have tried subclassing QRubberBand and adding a new Shape (Lasso) with custom paintEvent code and a QPainterPath to accumulate the mouse event points, but that is not working well. I can draw the "lasso", but there are also artifacts (one or more lines drawn from the window top left to the starting mouse point) which somehow seem to get inserted into the path.
I've checked the mouse positions (as best one can do that in mouse event handlers) and they look OK, and I don't see any (0,0) points being inserted.
I have looked through many of the previous posts here on rubber bands, and none of them seem to apply; they all deal with customizing the stock QRubberBand, not implementing a new one from scratch.
So, can anyone point me to code which provides an example of a QPainterPath or polygon / polyline - based rubber band? Any drawing packages for example?
Bookmarks