code: def mousePressEvent(self, event):
          
          if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
              self.calltip_widget.hide()
              self.setFocus()
              event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                                  Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
              QPlainTextEdit.mousePressEvent(self, event)
              QPlainTextEdit.mouseReleaseEvent(self, event)
              # Send selection text to clipboard to be able to use
              # the paste method and avoid the strange Issue 1445
              # NOTE: This issue seems a focusing problem but it
              # seems really hard to track
              mode_clip = QClipboard.Clipboard
              mode_sel = QClipboard.Selection
              text_clip = QApplication.clipboard().text(mode=mode_clip)
              text_sel = QApplication.clipboard().text(mode=mode_sel)
              QApplication.clipboard().setText(text_sel, mode=mode_clip)
              self.paste()
              QApplication.clipboard().setText(text_clip, mode=mode_clip)
          else:
              self.calltip_widget.hide()
              QPlainTextEdit.mousePressEvent(self, event)
docs: Reimplement Qt method