code: def dropEvent(self, event):
          
          if (event.mimeData().hasFormat("text/plain")):
              text = to_text_string(event.mimeData().text())
              if self.new_input_line:
                  self.on_new_line()
              self.insert_text(text, at_end=True)
              self.setFocus()
              event.setDropAction(Qt.MoveAction)
              event.accept()
          else:
              event.ignore()
docs: Drag and Drop - Drop event