Hello,

I searched for this, but somehow I can't find anything that solves this problem (I cannot believe that I am the only person with that problem).

Nevertheless, my problem is:
I have a GraphicsScene with a Tree of the same items.
On some item I want to reject the dragNdrop actions and accept the action on other items.
I Would like that the cursor shows, that the action will be rejected but it stays the same icon if I use setDropAction(Qt::IgnoreAction).

The two function implementations look like this:
Qt Code:
  1. void StateItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
  2. {
  3. const StateMimeData *data = qobject_cast<const StateMimeData*>(event->mimeData());
  4. if(data && state && state->getStateClass() && data->getState())
  5. {
  6. event->setDropAction(Qt::LinkAction);
  7. event->acceptProposedAction();
  8. }
  9. else
  10. {
  11. event->setDropAction(Qt::IgnoreAction);
  12. event->acceptProposedAction();
  13. }
  14. }
  15.  
  16. void StateItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
  17. {
  18. dragEnterEvent(event);
  19. }
  20.  
  21.  
  22.  
  23. void StateItem::dropEvent(QGraphicsSceneDragDropEvent *event)
  24. {
  25. const StateMimeData *data = qobject_cast<const StateMimeData*>(event->mimeData());
  26. if(data && state && state->getStateClass() && data->getState())
  27. {
  28. int i = 2;
  29. const QString newStateNameBase = data->getState()->getStateName();
  30. QString newStateName = newStateNameBase;
  31. while(!state->getStateClass()->addSubstate(data->getState(),newStateName, event->pos()))
  32. {
  33. newStateName = newStateNameBase + "_" + QString::number(i);
  34. i++;
  35. }
  36. event->setDropAction(Qt::LinkAction);
  37. event->acceptProposedAction();
  38. }
  39. else
  40. {
  41. event->setDropAction(Qt::IgnoreAction);
  42. event->acceptProposedAction();
  43. }
  44. }
To copy to clipboard, switch view to plain text mode 
If I use event->ignore(); it will just be passed to the parent item.

So how do I reject the action properly, that the mouse cursor shows that it will be rejected?