View Full Version : How to select the dropped item in a QTreeWidget?

Olivier Berten
6th June 2010, 22:42
self.setCurrentItem(self.itemAt(event.pos())) selects "randomly" the dropped item or the ones around it :confused:

Olivier Berten
8th June 2010, 11:36
for those interested, I achieved it by reimplementing the QTreeWidget.dropMimeData() method:

def dropMimeData(self, parent, index, data, action):
self.dropped = (parent,index)
idx = QModelIndex()
if parent: idx = self.indexFromItem(parent)
return QAbstractItemModel.dropMimeData(self.model(), data, action , index, 0, idx)