The action to be performed could be decided within QAbstractItemModel::dropMimeData(). Of course you can do that in the dropMoveEvent() method, but remember to call the base class implementation.
Qt Code:
void SubClass::someMethod() { BaseClass::someMethod(); // <--- // do something in addition to what base class does ... }To copy to clipboard, switch view to plain text mode
J-P Nurmi
My model (subclass of abstract table model) should accept copy actions when dragging from another widget, while accepting move actions when dragging within the widget.
If the action to perform can be decided within QAbstractItemModel::dropMimeData(), how can I operate on the source model when moving?
In other word: if I choose to copy or move within dropMimeData, shoudn't I have access to a QModelIndex for the source data?
I'm wondering:
dropMimeData knows which action should be performed, but returns a bool. So, another object should get this return value and - i guess - this object should check if the move action returned a true and, if it is true, the source object should then ask to source model to remove the data.
How can this be done within dropMimeData?
(Actually I'm really noob with drag and drops, still learning what's behind the curtains
Shouldn't this decision be taken by the view? (e.g. in the startDrag() ?)
Thanks
Bookmarks