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

QQuickWidget::dragEnterEvent always accepts events, even when no Qml code does, which prevents C++ from handling a background drag&drop.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.10.1
    • Quick: Widget
    • None

    Description

      Sometimes, with a QQuickWindow, it can be necessary to handle drop events in C++ for areas that are not covered by a DropArea Qml item. This seems impossible because QQuickWidget::dragEnterEvent always accepts the event, regardless of what its internal QQuickWindow had set as event acceptance. From qquickwidget.cpp:

      void QQuickWidget::dragEnterEvent(QDragEnterEvent *e)
      {
        Q_D(QQuickWidget);
        d->offscreenWindow->event(e);
        e->accept(); // <-- This line overrides any informative e->setAccepted
                     //     that might have been set before.
      }

      Then if I derive QQuickWidget and overload dragEnterEvent, I cannot know whether I should handle the event or not after having called QQuickWidget::dragEnterEvent, as it always be marked as accepted whether Qml code did accept it or not.

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            domgenest Dominic Genest
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes