code: def eventFilter(self, object, event):
          
          edit = self.lineEdit()
          
          if not (object and object == self._treePopupWidget):
              return super(XOrbRecordBox, self).eventFilter(object, event)
          
          elif event.type() == event.Show:
              object.resizeToContents()
              object.horizontalScrollBar().setValue(0)
          
          elif edit and event.type() == event.KeyPress:
              # accept lookup
              if event.key() in (Qt.Key_Enter,
                                 Qt.Key_Return,
                                 Qt.Key_Tab,
                                 Qt.Key_Backtab):
                  
                  item = object.currentItem()
                  text = edit.text()
                  
                  if not text:
                      record = None
                      item = None
                  
                  elif isinstance(item, XOrbRecordItem):
                      record = item.record()
                  
                  if record and item.isSelected() and not item.isHidden():
                      self.hidePopup()
                      self.setCurrentRecord(record)
                      event.accept()
                      return True
                  
                  else:
                      self.setCurrentRecord(None)
                      self.hidePopup()
                      edit.setText(text)
                      edit.keyPressEvent(event)
                      event.accept()
                      return True
                  
              # cancel lookup
              elif event.key() == Qt.Key_Escape:
                  text = edit.text()
                  self.setCurrentRecord(None)
                  edit.setText(text)
                  self.hidePopup()
                  event.accept()
                  return True
              
              # update the search info
              else:
                  edit.keyPressEvent(event)
          
          elif edit and event.type() == event.KeyRelease:
              edit.keyReleaseEvent(event)
          
          elif edit and event.type() == event.MouseButtonPress:
              local_pos = object.mapFromGlobal(event.globalPos())
              in_widget = object.rect().contains(local_pos)
              
              if not in_widget:
                  text = edit.text()
                  self.setCurrentRecord(None)
                  edit.setText(text)
                  self.hidePopup()
                  event.accept()
                  return True
              
          return super(XOrbRecordBox, self).eventFilter(object, event)
docs: Filters events for the popup tree widget.
          
          :param      object | <QObject>
                      event  | <QEvent>
          
          :retuen     <bool> | consumed