Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81962

QDropEvent::setDropAction(Qt::DropAction) is ignored on macOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.2, 5.12.7
    • Fix Version/s: None
    • Component/s: GUI: Drag and Drop
    • Labels:
      None
    • Environment:
      macOS Catalina, macOS High Sierra
    • Platform/s:
      macOS

      Description

      When dragging from a QWidget supporting both Qt::CopyAction and Qt::MoveAction, the source widget always receives Qt::MoveAction regardless of what the drop target widget specifies in dropEvent().

      Eg: In the drop target widget:

      void widget::dropEvent(QDropEvent *event)
      {
       event->setDropAction(Qt::CopyAction);
       event->accept();
      }
      

      The overridden drop action is never propagated back to the widget which initiated the drag.

      This results in the drag source removing the item instead of copying it.

      It is particularly obvious when dragging from QAbstractItemView widgets, as they will automatically remove the dragged item.

      It appears that in qnsview_dragging.mm, (BOOL)performDragOperation:(id <NSDraggingInfo>)sender is discarding the accepted_action returned from the QWindowSystemInterface::handleDrop() calls

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            vestbo Tor Arne Vestbø
            Reporter:
            rthompson Richard Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes