Cancelling last point displayed QPainter
point is shown where user clicks(left/right click) ->stored in array, point displayed via the same array
Created a pop up menu on right click
which includes a Cancel option
which needs to clear the last action the painter function done
(for instance the last action was drawing a point at x,y -> that point needs to be cleared, but only that point)
How do I go about doing that
Re: Cancelling last point displayed QPainter
You can't. You have to repaint all points or use e.g. a QGraphicsScene/View.
Re: Cancelling last point displayed QPainter
How do I call repaint again.
I created an if statement in my paint function within label-class
Code:
if (cancel ==true)
//cancel last point
//delete point from array
How do I recall paint in the if statement with the updated array
so only the points now in array will be displayed?
Or do I create another paint function & call it from the original paint function.
//Getting to grips with the paint function!
Thanks
Kind Regards
Re: Cancelling last point displayed QPainter
Well you have a array, where you store the points. Then simply add/remove points of that array (e.g. QList<QPoint>) and afterwards call update(). Inside the paint method I wouldn't do any logic. simply paint all points of the array.