I meant this:
Qt Code:
  1. void QTemplateWidget::dragEnterEvent (QDragEnterEvent *event)
  2. {
  3. event->accept();
  4. }
To copy to clipboard, switch view to plain text mode 

and

Qt Code:
  1. if(!event->mimeData()->hasText())
  2. {
  3. event->ignore();
  4. return;
  5. }
To copy to clipboard, switch view to plain text mode 

The docs suggest:

Qt Code:
  1. void Window::dragEnterEvent(QDragEnterEvent *event)
  2. {
  3. if (event->mimeData()->hasFormat("text/plain"))
  4. event->acceptProposedAction();
  5. }
To copy to clipboard, switch view to plain text mode 

You shouldn't accept every type that exists like you do.