code: def focusOutEvent(self, event):
          
          self.clicked_outside = True
          return super(QLineEdit, self).focusOutEvent(event)
docs: Detect when the focus goes out of this widget.
  
          This is used to make the file switcher leave focus on the
          last selected file by the user.