code: def eventFilter(self, obj, event):
          
          if obj == self._text_edit:
              etype = event.type()
  
              if etype == QEvent.KeyPress:
                  key = event.key()
                  cursor = self._text_edit.textCursor()
                  prev_char = self._text_edit.get_character(cursor.position(),
                                                            offset=-1)
                  if key in (Qt.Key_Enter, Qt.Key_Return,
                             Qt.Key_Down, Qt.Key_Up):
                      self.hide()
                  elif key == Qt.Key_Escape:
                      self.hide()
                      return True
                  elif prev_char == ')':
                      self.hide()
  
              elif etype == QEvent.FocusOut:
                  self.hide()
  
              elif etype == QEvent.Enter:
                  if (self._hide_timer.isActive() and
                    self.app.topLevelAt(QCursor.pos()) == self):
                      self._hide_timer.stop()
  
              elif etype == QEvent.Leave:
                  self._leave_event_hide()
  
          return super(CallTipWidget, self).eventFilter(obj, event)
docs: Reimplemented to hide on certain key presses and on text edit focus
              changes.