I've run into a problem with QTreeView where child items are not being moved during a drop. It seems that reimplementing dragMoveEvent causes this to happen. It's supposed to read a user variable from the item being dragged and compare it to the item where it is going to be dropped. If they have the same value then it calls QTreeView's dragMoveEvent, otherwise it ignores the event. I'm doing this because Qt doesn't allow accepted mimeTypes to be set for each individual item (or does it?).

Qt Code:
  1. void ResourceView::dragMoveEvent(QDragMoveEvent *event)
  2. {
  3. QModelIndex index = indexAt(event->pos());
  4.  
  5. QDataStream stream( &event->mimeData()->data("resource/index"), QIODevice::ReadOnly);
  6. int type;
  7. int parentType =-1;
  8.  
  9. int r, c;
  10.  
  11. QMap<int, QVariant> v;
  12. stream >> r >> c >> v;
  13.  
  14. parentType = index.data( Qt::UserRole+1).toInt();
  15. type = v[Qt::UserRole+1].toInt();
  16.  
  17. if (parentType == type)
  18. {
  19. QTreeView::dragMoveEvent( event);
  20. }
  21. else
  22. {
  23. event->ignore();
  24. }
  25. }
To copy to clipboard, switch view to plain text mode 

The child items are moved when I completely comment this out. On the other hand, if I call QTreeView::dragMoveEvent( event) alone with the other stuff commented out in the function the problem still persists. What could be the issue?