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

QAbstractItemView handles drop event action inconsistently

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Incomplete
    • Affects Version/s: 5.15
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      All

      Description

      When QAbstractItemView handles drop events (e.g. in the methods dragEnterEvent, dragMoveEvent, dropEvent) it has to evaluate the action of the event. This is done correctly by quering the dropAction method of the event.

      However, when the event is later accepted by those methods, this is sometimes done via the event's acceptProposedAction method instead of accept. This is wrong, as the event's action is then overwritten by the proposed action - but all the processing and checking before used the event's action.

      Normally, this does not lead to problems as the event's action is set to its proposed action. As soon as somebody overrides the drop handling methods and sets a different action (which is a totally reasonable thing to do if you want to select the action based on the drop target), then things fall apart. First all checking is done on the replacement action, but in the end the event will be forced back to the preferred action leading to accepting/declining the drops based on the wrong action.

      The right thing to do here is to definitely stay away from acceptProposedAction, and just use accept().

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            florianb82 Florian Benz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes