I have a class derived from QTableWidget, receiving drag'n'drop from external files and displays the name. The default action is Qt::CopyAction, and to ensure that the action to be performed is Qt::LinkAction, I must use drag->exec(Qt::LinkAction).

Qt Code:
  1. void tableWidget::dropEvent(QDropEvent *event) {
  2. //…
  3. QDrag *drag = new QDrag(this);
  4. //…
  5. }
To copy to clipboard, switch view to plain text mode 

Since
Qt Code:
  1. event->mimeData()
To copy to clipboard, switch view to plain text mode 
returns data as const QMimeData and drag->setMimeData(data) accept argument as QMimeData, there is a way to overcome this problem?