Drag and Drop "possibleActions" lost



  • In a drag and drop Operation the possible Actions of my drag are different from the drop. Here an example:

     bool MyTreeView::eventFilter(QObject *i_obj, QEvent *i_event)
      {
        switch(i_event->type())
        {
        case QEvent::DragMove:
          {
            QDragMoveEvent* dragMove = dynamic_cast<QDragMoveEvent*>(i_event);
            qDebug() << dragMove->possibleActions();
            break;
          }
        case QEvent::Drop:
          {
            QDropEvent* drop = dynamic_cast<QDropEvent*>(i_event);
            qDebug() << drop->possibleActions();
            break;
          }
        }
        return Superclass::eventFilter(i_obj, i_event);
      }``
    
    The answer of the flags are the following:
      QFlags<0x1|0x2>  (DragMove)
      QFlags<0x1>	   (Drop)
    
    How can be that possible? why the drop Event is only returing one of the two flags?
    
    Thank you!
    Jorge

  • Lifetime Qt Champion

    Hi,

    Maybe a silly questions but are you sure you are printing both event separately ?



  • Hi SGaist, thank you for your answer. Yes, i'm sure that i'm printing the events separately.


  • Lifetime Qt Champion

    How did you setup the drag and drop stuff on your MyTreeView class ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.