Perform an internal and external drag and drop


I’ve a class component that need to be draggable internally to enable drop on another component of the same type - for copying the business date for one object to another.
I need also to be able to export it as a file, so i also need to be able to perform an external drag&drop.

I’ve found a solution but there’s a little issue. Peharps there’s something i missed.
Here’s what i’ve done:

In my class component i’ve implemented DragAndDropTarget, and mouseDrag with a call to myContainer->startDragging in order to be able to do an internal drag.
This works fine. Then in the same mouseDrag method, just after calling startDragging method, i make a call to DragAndDropContainer::performExternalDragDropOfFiles.
This works fine too, when i drag the component, i’m able to export it as a file on the desktop and onto another component of the same class.

But there’s an issue when drag&dropping internally: During drop, when i release the mouse button on the destination component, the itemDropped function isn’t called if the mouse stay at the same point i dropped the item. if i move the mouse the itemDropped function is called. So it sounds that the system needs a mouseMove to trigger the itemDropped method in that case.

If i comment the call to DragAndDropContainer::performExternalDragDropOfFiles, the problem disappears.

Any idea?


1 Like