code: def keyPressEvent(self, event):
          
          key = event.key()
          if key in [Qt.Key_Escape]:
              self.clear_text()
          else:
              super(LineEditSearch, self).keyPressEvent(event)
docs: Qt override.