What is the base class of the popup menu? If it's QPopupMenu and you trigger it with exec(), it should hide itself when you click outside the menu or choose one of its actions.