PDA

View Full Version : Drag and drop



iswm
9th April 2007, 23:46
I have drag and drop implemented using a QTreeView (setItemsExpandable is false), and everything is working nicely. The problem I'm having, however, is that I need to get the row number that an item was dropped FROM when said item gets dropped (within the same view). Is there any way to do this?

marcel
10th April 2007, 01:03
If I am not mistaking, when you build the mime data and the drag data for drag and drop, in QTreeWidget::mimeData, you're being passed a list of QTreeWidgetItems.
Couldn't you find out the selected item's row here and include it somehow in the drag data?

iswm
10th April 2007, 01:41
I've considered doing this, and even tried to implement it. The problem is that it's just so messy. My reimplementation of QAbstractItemModel::mimeData() is passed at least 4 indexes at a time (4 colummns per row), so it turns into a logistical mess that feels pretty dirty.