Ubuntu: How do you detect the end of a live drag with the new ListItem?



Question:

The new ListItem has the ability to do live drag-and-drop reorderings. When one is in progress, how do you detect its end?

The ListItem had the ViewItems.onDragUpdated signal, which should fire for three types of events: Started, Moving, and Dropped. When all the Moving events are accepted, as they are in a live drag, no Dropped event is generated at the end. Is there a way to force this to happen? Or is there another way to tell when the user has dropped the item?


Solution:1

The event is not triggered as the from and to indices are the same. When in live mode, you must update your model on each move, as that is the way to tell the ListView behind that your element ordering is changed. It is not expected to fire any event as long as the from and to indices are having the same value, which is the case in Dropped state when on live mode. Of course, Dropped may be a special case, which should be emitted never the less the two indices are the same.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »