In your painEvent() you reset vtempButtonPushed back to false, so after one paint you reset the condition for painting.

So the next time paintEvent() is called you draw nothing.

If you want the line to be persistent, don't reset the condition that enables it

Cheers,
_