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

after one (large-distance) mouse move event, DragHandler.translation is still zero

    XMLWordPrintable

Details

    Description

      void QQuickDragHandler::handlePointerEventImpl(QQuickPointerEvent *event)
      {
          QQuickMultiPointHandler::handlePointerEventImpl(event);
          event->setAccepted(true);
      
          if (active()) {
              // Calculate drag delta, taking into account the axis enabled constraint
              // i.e. if xAxis is not enabled, then ignore the horizontal component of the actual movement
              QVector2D accumulatedDragDelta = QVector2D(m_centroid.scenePosition() - m_centroid.scenePressPosition());
              if (!m_xAxis.enabled())
                  accumulatedDragDelta.setX(0);
              if (!m_yAxis.enabled())
                  accumulatedDragDelta.setY(0);
              setTranslation(accumulatedDragDelta);
          } else {
      ...
      

      setTranslation() is called only when handling a mouse move after the DragHandler already became active. So after the first mouse movement, if you have dragged past the threshold, the target moves, but translation() returns (0, 0). This came up while writing a nice simple single-move autotest for QTBUG-74966.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes