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

Improve canDropMimeData/dropMimeData API

    XMLWordPrintable

    Details

      Description

      Suggestion:

      Change

      bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent;) const
      

      to more closely mimic the API of QDropEvent:

      Qt::DropAction QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropActions possibleActions, Qt::DropAction proposedAction, int row, int column, const QModelIndex &parent;) const

      If you return IgnoreAction, that's like returning false, and the event is
      ignored. Otherwise whatever you return goes to QDragMoveEvent::setDropAction.

      If they want to ask a different question, they hit a modifier key, and we ask
      with a different proposedAction

      Generally if you returned true now, you'd return proposedAction in this
      interface.

      Why:

      What you gain is the ability to tell a source that allowed both move and copy, proposing move, that you only accept copy and thus give the user the right cursor feedback.

      I want to know all the possibleActions() from the QDragMoveEvent (so I can know Copy is actually allowed) and I want to know which one was proposed (so I can default to following the modifier-keys the user was holding down), and I want to be able to override that (if I support one of the possible actions, but not the currently proposed one).

       

       

        Attachments

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

          Activity

            People

            Assignee:
            dfaure_kdab David Faure
            Reporter:
            miikapernu Miika Pernu
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes