I figured it out!!
To support drag events for QGraphicsScene you must allow drops on the scene
setAcceptDrops(true);
setAcceptDrops(true);
To copy to clipboard, switch view to plain text mode
create a QDrag object with mime data in the mousePressEvent()
drag
->setMimeData
(new QMimeData());
// does not work without mime datadrag->exec();
QDrag *drag = new QDrag(this);
drag->setMimeData(new QMimeData()); // does not work without mime data
drag->exec();
To copy to clipboard, switch view to plain text mode
and accept the drag event in dragEnterEvent()
event->acceptProposedAction();
}
void dragEnterEvent(QDragEnterEvent *event) {
event->acceptProposedAction();
}
To copy to clipboard, switch view to plain text mode
Then you can catch the dragMoveEvent()
Phew - that's a lot of work. I would certainly prefer if mouseMoveEvent() still worked when the mouse button was down.
Bookmarks