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