Drag and drop feature to EWO

Find and share HowTos to various installations / configurations!
3 posts • Page 1 of 1
sblancha
Posts:64
Joined: Thu Feb 18, 2016 4:18 pm

Drag and drop feature to EWO

Post by sblancha »

Hello,

I'd like to drag an object to my custom Qt EWO.
I have added the property dragDrop in my EWO C++ code and now I see dragDrop event in GEDI, but it seems dragDrop event is triggered when I drag and drop my EWO to another shape and I rather want the opposite, e.g. triggered an event when object is dropped into my EWO! I have checked the help and as far as I understand I need a "drop enter" property but I have not find how to set this property for EWO, is it possible? if yes how to proceed?

PS: It is not easy to explain this in short sentences, tell me if I am not clear.

Thanks
Sebastien

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Drag and drop feature to EWO

Post by Gertjan van Schijndel »

Regarding the drop event I found this information in the documentation under: Graphics editor (GEDI) -> Complex graphics objects -> EWO (External Widget Object) -> Ewo development:
Drop Event
To use drag and drop for your EWO the drop event handling can be added to your EWO implementation. To add the event handling to your EWO the EWO itself (not the QWidget used inside of the EWO) must be extended with following command inside of the EWO constructor:

setProperty("-droppedEvent", QLatin1String("main(string information, int dragType)"));
The arguments of the main function depend on the arguments that are passed as values inside of the signal. This means, that depending on the signal custom arguments can be implemented.

This interface is used for the drop script inside of the GEDI (as part of the property editor).
However this will only make the drop event available as an event of your ewo. By emitting the "-droppedEvent" signal the drop event scripting will be triggered.

But receiving the drop event works the same as with any other Qt widget, see Qt Documentation.

sblancha
Posts:64
Joined: Thu Feb 18, 2016 4:18 pm

Re: Drag and drop feature to EWO

Post by sblancha »

Thanks for the help.
I managed to make drop to my EWO working with a feedback event but i trig a custom extended event and not the 'standard' drag and drop event. Anyway I have the requested behavior and so release this method.
Bye
Sebastien

3 posts • Page 1 of 1