Do Something Depending on a Mouse Event

How can I draw something (or just do something in another member function) that happens on a mouse event, like Component::mouseDown()? I'm having a hard time trying to figure out how that works exactly. Any help would really be appreciated.

Store the data related to the mouse events as a member variable and use it in the paint method

and don't forget to call repaint()