Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Description
Suggestion:
Change
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent;) const
to more closely mimic the API of QDropEvent:
Qt::DropAction QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropActions possibleActions, Qt::DropAction proposedAction, int row, int column, const QModelIndex &parent;) const
If you return IgnoreAction, that's like returning false, and the event is
ignored. Otherwise whatever you return goes to QDragMoveEvent::setDropAction.
If they want to ask a different question, they hit a modifier key, and we ask
with a different proposedAction
Generally if you returned true now, you'd return proposedAction in this
interface.
Why:
What you gain is the ability to tell a source that allowed both move and copy, proposing move, that you only accept copy and thus give the user the right cursor feedback.
I want to know all the possibleActions() from the QDragMoveEvent (so I can know Copy is actually allowed) and I want to know which one was proposed (so I can default to following the modifier-keys the user was holding down), and I want to be able to override that (if I support one of the possible actions, but not the currently proposed one).