I would like to know if there is a way to dectect when user clicks anywhere in a QDialog.

We are using a QDialog to show a popup to the user, we would like that if user clicks the popup anywhere this hides. To detect if the user clicks the QDialog anywhere we have try it reimplementing mousePressEvent, but the problem is if the user click in a GroupBox that it's inside the QDialog or an Image, then we don't receive the mousePressEvent. It seems that the mousePressEvent only is thrown if the user clicks the region of QDialog with no widgets.