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?

share|improve this question
    
What about the signal that the own component fires? contentMovementEnded() – Lucio Sep 21 '15 at 18:42
    
@Lucio: It's not working for me. Can you post an example? – Robert Schroll Sep 21 '15 at 19:40
    
Sorry, I was just throwing my two cents. In fact, I'd never use qml :) – Lucio Sep 21 '15 at 20:18
up vote 0 down vote accepted

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.

share|improve this answer
    
Understood, but it seems like being able to react to the drop would be useful. In my case, the model is representing data stored in a database. It'd be more efficient to update the database only when the drag ends, rather than each time the model gets reordered. Should I file a feature request? – Robert Schroll Sep 22 '15 at 17:54
    
Live update cannot happen without model updates. The model update is the one which drives the animations, proper repositioning. If you read the documentation, it is even said that if you have a model whose update is a heavy operation, such as database updates, then use the non-live drag'n'drop instead of leave. Then you get the drop event. But, if you still want the drop event to be received in live update case, file a feature request. – Zsombor Egri Sep 24 '15 at 4:40
    
Feature request filed here: bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/… – Robert Schroll Sep 27 '15 at 0:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.