Drag & drop items on the same QTreeView
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?
Re: Drag & drop items on the same QTreeView
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...)
Re: Drag & drop items on the same QTreeView
indexAt is the right way. Tnx