PDA

View Full Version : Drag & drop items on the same QTreeView



wind
8th October 2006, 15:51
I want to drag & drop items on the same QTreeView. All is working great visually on the treeview,
but i also need to change my data in the database. So i need to know which item is dragged and the location (index) where the item is dropped.

I subbclassed QTreeView but can figure out how to get the index location of the dropped item. Any hints?

fullmetalcoder
9th October 2006, 08:29
1) Do you use a custom model ?
2) Does the view know the model type ?
3) QAbstractItemView:indexAt(const QPoint&) should be useful (usually a static_cast is performed on the internalPointer() to get whatever object your model use and act on it...)

wind
11th October 2006, 15:29
indexAt is the right way. Tnx