code: def keyPressEvent(self, event):
          
          if event.key() in (Qt.Key_Enter, Qt.Key_Return):
              self.clicked()
          elif event.key() == Qt.Key_F2:
              self.rename()
          elif event.key() == Qt.Key_Delete:
              self.delete()
          elif event.key() == Qt.Key_Backspace:
              self.go_to_parent_directory()
          else:
              QTreeView.keyPressEvent(self, event)
docs: Reimplement Qt method