PDA

View Full Version : Drag&Drop problem in a QTreeView



Andy_CH
15th December 2009, 22:45
Hi everyone,

I'm facing a pretty strange problem and I need some help from your brains :)

1) I'm using Qt 4.6.0
2) I want to enable drag&drop (Qt::MoveAction with QAbstractItemView::InternalMove only) on items in a treeview.
3) I have my own model and a proxy model used to perform some sorting...
4) Drag&Drop works well except for one single thing, here it is :

When I perform some "real quick" drag&drops in the tree (basically throwing items from a parent to another) or when I'm trying to throw an item out of the three (above the first parent, between the top parent and the treeview's viewport's limit), the moving item disappears...
Even worse, sometimes, a corrupted item is created above my first folder (See the following pictures).

[Image Before]
http://img204.imageshack.us/img204/7316/beforetreecorruption.jpg

[Image After]
http://img121.imageshack.us/img121/2797/corruptedtree.jpg


Let's try and summarize a bit :
When I perform quick and random moves with the items in the tree(changing their parents or re-placing the items in their current parent), sometimes I have items that go everywhere but where they should... I also remind you guys that when used "normally" my drag&drop works...

I hope I've been clear enough, don't hesitate to ask for further details !

Thanks in advance for your help !!