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

On Mac OS X, drag and drop only works with the left mouse button

    XMLWordPrintable

Details

    • macOS

    Description

      On Mac OS X, drag and drop operations do not work with the middle or the left button. The action is filtered to only work with the left button.

      Some application use a different drag and drop depending on the button of the mouse.

      Here is a patch to change this behavior:

      diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
      index 722e3e2..9cbd501 100644
      --- a/src/gui/kernel/qcocoaview_mac.mm
      +++ b/src/gui/kernel/qcocoaview_mac.mm
      @@ -1169,10 +1169,6 @@ Qt::DropAction QDragManager::drag(QDrag *o)
           }
           if(object == o)
               return Qt::IgnoreAction;
      -    /* At the moment it seems clear that Mac OS X does not want to drag with a non-left button
      -     so we just bail early to prevent it */
      -    if(!(GetCurrentEventButtonState() & kEventMouseButtonPrimary))
      -        return Qt::IgnoreAction;
      
           if(object) {
               dragPrivate()->source->removeEventFilter(this);
      diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm
      index ec8005c..7477d2b 100644
      --- a/src/gui/kernel/qdnd_mac.mm
      +++ b/src/gui/kernel/qdnd_mac.mm
      @@ -536,10 +536,6 @@ Qt::DropAction QDragManager::drag(QDrag *o)
           }
           if(object == o)
               return Qt::IgnoreAction;
      -    /* At the moment it seems clear that Mac OS X does not want to drag with a non-left button
      -       so we just bail early to prevent it */
      -    if(!(GetCurrentEventButtonState() & kEventMouseButtonPrimary))
      -        return Qt::IgnoreAction;
      
           if(object) {
               dragPrivate()->source->removeEventFilter(this);
      

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes