View Full Version : Drag & Drop when parent and childs accept drops?

17th October 2008, 10:00

I've some questions about the drag & drop functionality of Qt. It does not work as I expected but I think thats because of my lack of understanding.

In my program for example I have a QTabWidget which accepts drops. The tab widget contains some QTreeView's where each of them also accepts drops. When I'm dragging something over the QTreeView, the QTabWidget receives the dragEnterEvent() etc.. It does not accept the drag event so I thought the drag event will be redirected to the next child which accepts drops, but it does not! :(

So how can I get my QTreeView's to receive their drop data?

PS: Also my QTabWidget receives a dragEnter and dragLeave event for each of it's child widgets (QTabBar, the corner widgets), but the drag event does not contain any information about the window under the mouse ... so in my thought I should not receive these events? But that's maybe a 4.4.0 bug (can't update at the moment).

EDIT: Seems like I've posted too fast ... QApplication walks up from the drag receiver to a parent which accepts drags - so it seems to be my fault.

EDIT #2: Ok, all my fault, the model on the tree did not return Qt::ItemIsDropEnabled :( argh ...

Thanks for your suggestions,