<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def focusOutEvent(self, event):

 """Reimplement Qt method to close the widget when loosing focus."""

        event.ignore()
        # Inspired from CompletionWidget.focusOutEvent() in file
        # widgets/sourcecode/base.py line 212
        if sys.platform == "darwin":
            if event.reason() != Qt.ActiveWindowFocusReason:
                self.close()
        else:
            self.close()