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()