code: def eventFilter(self, object, event):
          
  
          if event.type() == QEvent.KeyPress:
              if event.key() in (Qt.Key_Enter, Qt.Key_Return):
                  object.search()
              elif event.key() in (Qt.Key_Escape,):
                  object.close()
              return True
          else:
              return QObject.eventFilter(self, object, event)
docs: Reimplements the **QObject.eventFilter** method.
  
          :param object: Object.
          :type object: QObject
          :param event: Event.
          :type event: QEvent
          :return: Event filtered.
          :rtype: bool