37 if (event->source() ==
this && event->possibleActions() & Qt::MoveAction)
42 if (event->proposedAction() == Qt::MoveAction) {
43 event->acceptProposedAction();
46 emit dragResult(tr(
"The data was moved here."));
48 }
else if (event->proposedAction() == Qt::CopyAction) {
49 event->acceptProposedAction();
52 emit dragResult(tr(
"The data was copied here."));
61 emit mimeTypes(event->mimeData()->formats());
62 setData(event->mimeData()->formats()[0],
63 event->mimeData()->data(event->mimeData()->formats()[0]));
79 if (!(event->buttons() & Qt::LeftButton))
81 if ((event->pos() - dragStartPosition).manhattanLength()
82 < QApplication::startDragDistance())
85 QDrag *drag =
new QDrag(
this);
86 QMimeData *mimeData =
new QMimeData;
88 mimeData->setData(mimeType, data);
89 drag->setMimeData(mimeData);
91 Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
96 emit dragResult(tr(
"The text was copied."));
99 emit dragResult(tr(
"The text was moved."));
102 emit dragResult(tr(
"Unknown action."));