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

QEvent::Wheel events are being eaten during Drag & Drop (QBasicDrag::eventFilter)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.6, 5.12.0 Beta 2
    • GUI: Drag and Drop
    • None
    • Windows
    • All

    Description

      The QBasicDrag::eventFilter method is intentionally eating scroll events, resulting in intermittent scroll results in QWidgets on Windows. Because the QEvent::Wheel events are being eaten during drag and drop, only scroll events which occur on the same frame that DND calls processEvents() are issued to the rest of the application. This results in repeated scrolling to register a single scroll, and entirely undesirable behaviour.

      I would advise a small code change to qtbase\src\gui\kernel\qsimpledrag.cpp : 195

      case QEvent::MouseButtonDblClick:
                  return true;
      case QEvent::Wheel:
                  const QMouseEvent *scroll = static_cast<QMouseEvent *>(e);
                  const QWindow *scrollWindow = topLevelAt(scroll->globalPos());
                  if (!scrollWindow)
                      scrollWindow = m_current_window;
                   QPoint scrollWindowPos = (scrollWindow ? scrollWindow->mapFromGlobal(scroll->globalPos()) : scroll->globalPos());
                   QMouseEvent *newScroll = new QMouseEvent(scroll->type(),
                      scrollWindowPos, scrollWindowPos, scroll->screenPos(),
                      scroll->button(), scroll->buttons(),
                      scroll->modifiers(), scroll->source());
                  QCoreApplication::postEvent(o, newScroll);
                  return true; // defer mouse scroll events until drag event loop has returned
      

      This code is based off the case for QEvent::MouseButtonRelease and should result in scroll events being passed to the application properly.

      This is highly desirable as drag operations typically occur on a list, and it is a non-intrusive and natural methodology to utilize the scroll wheel to scroll the list view or other destination widget.

      QTBUG-45838 reports this behaviour as an issue; this solution should resolve that.

      I've marked affected versions as 5.9.6 (the version we're running internally) and 5.12 after verifying this code has not changed in the latest distributions of source for 5.12.

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-71288
          # Subject Branch Project Status CR V

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              shaander1 Shawn Anderson
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change