code: def keyPressEvent(self, event):
          
          QToolTip.hideText()
          ctrl = event.modifiers() & Qt.ControlModifier
  
          if event.key() in [Qt.Key_Enter, Qt.Key_Return]:
              if ctrl:
                  self.process_text(array=False)
              else:
                  self.process_text(array=True)
              self.accept()
          else:
              QDialog.keyPressEvent(self, event)
docs: Qt override.