Thanks the spinner trick worked just fine... the painter.save() line it holds the current shapes drawn , when I remove this line and call the draw method it erases previous shapes
Thanks the spinner trick worked just fine... the painter.save() line it holds the current shapes drawn , when I remove this line and call the draw method it erases previous shapes
QPainter::save() saves the current state of the painter not the painted device. That state is stored internally to the QPainter and can only live as long as the QPainter exists, which in this case is until the end of the paintEvent(). You never call QPainter::restore() so the saved states are never reused.
Subsequent calls to the paintEvent() only draw the shape associated with the last clicked button because that is the logic you have implemented by clearing the px flag after drawing the shape x.
mernarezk (2nd December 2013)
No the Px flags are not the problem, I searched and I should use the painter on a painting device like a PixMap or anything like canvas in java but I am have no idea how to use them, so any idea how can I overcome the problem that painter deletes previous shapes when trying to draw a new one ? ...one more question is there anyway to invert my axis ? x=0 , y=0 are at the top left corner is it possible to make them like cartesian coordinates x,y=0,0 at the botton left cornor ?
If you want to accumulate a set of marks on the page then you need to keep a persistent track of either the page or the actions required to draw it. I suggest you spend some time with the Scribble Example, particularly the ScibbleArea class.
For the axis reversal:
Coordinate System: Transformations
QPainter::scale() with a negative scale in the Y direction.
Bookmarks