Drag/Drop a copy of an Item

Pulkit Gupta pulkitnsit at gmail.com
Tue Feb 28 15:29:06 UTC 2017


Hi Utkarsh,

You can see my activity Digital Electricity in which I have implemented this:
https://github.com/gcompris/GCompris-qt/tree/gsoc_pulkit_digital_electricity/src/activities/digital_electricity

The basic idea is that whenever the image is clicked, you remove its
anchors, update its co-ordinates to let it drag (See the
MultiPointTouchArea in DragListItem.qml of Digital Electricity), and
when the image is released, create a copy of it on the specified drop
point (see createComponent() function in digital_electricity.js file),
and let the original image to go back to its original position by
changing its anchors to the previous value.

If you want to see how to create specific drop area, then see the
babymatch activity.

If you have any other doubts, feel free to ask :).

Regards,
Pulkit


On 2/28/17, Utkarsh Tiwari <iamutkarshtiwari at gmail.com> wrote:
> Hi,
>      I am trying to implement the drag/drop functionality in Railroad
> activity. I want to drag a clone/copy of the clicked image onto the
> specified drop area. I looked through the GCompris code but couldn't find
> any activity(like Chess, enumerate, tangram, scaleboard) which makes a
> clone of the object while drag/drop.
>
> Could anyone please suggest any ideas on how to get about it?
>
> Regards,
> Utkarsh Tiwari
>
> --
> Regards,
> Utkarsh Tiwari
>


More information about the GCompris-devel mailing list