PDA

View Full Version : Drag and Drop from a list, is this even posssible with QML?



technoViking
13th December 2010, 17:42
Hi guys,

I have a backend model in C++ that is being pushed to a ListView in QML. I want the user to be able to drag a list item from the list and drop it which will remove the element from the list.


Is drag and drop (or hacking to make it look like its really drag and dropping) possible with QML? If so could someone direct me to an example perhaps?

Thanks

antialias_forum
22nd December 2010, 16:17
On the colums page of the documentation there is something that might be used for this (look at the paragraph on transitions)
http://doc.qt.nokia.com/4.7/qml-column.html
But there you'd have to reimplement the entire ListView functionality

Another idea would be to remove/add the item from/to the list on the drag event in the C++ code and push the list to the QML again (probably rather inefficient for large lists).

I found this 3rd Party solution but haven#t tried it out (since I'm planning on using drag and drop for lists in the near future, too)
https://bitbucket.org/gregschlom/qml-drag-drop

I haven't really decided which way to go yet. Still hoping the Trolls will come up with something official.