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

Use the time stamp of the touch event when deliver touch as mouse

    XMLWordPrintable

Details

    • All
    • 3c3aef1486 (qt/qtdeclarative/dev) b7a6d06705 (qt/qtdeclarative/6.4) b7a6d06705 (qt/tqtc-qtdeclarative/6.4) 4049293182 (qt/qtdeclarative/6.3) 4049293182 (qt/tqtc-qtdeclarative/6.3)

    Description

      Use the time stamp of the touch event when converting a touch event to a mouse event for items that do not handle touch events (such as PathView etc)

      diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
      index 44255a74f8..fdafff0901 100644
      --- a/src/quick/util/qquickdeliveryagent.cpp
      +++ b/src/quick/util/qquickdeliveryagent.cpp
      @@ -81,6 +81,7 @@ void QQuickDeliveryAgentPrivate::touchToMouseEvent(QEvent::Type type, const QEve
                                        (type == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton),
                                        touchEvent->modifiers(), Qt::MouseEventSynthesizedByQt);
           ret.setAccepted(true); // this now causes the persistent touchpoint to be accepted too
      +    ret.setTimestamp(touchEvent->timestamp());
           *mouseEvent = ret;
       }
       

       

      A series of touch events in a very short period of time may be ignored or the accuracy of velocity calculation may be reduced without above fix.

      For example, because of the code below.

      qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) const
      {
          if (0 != event->timestamp())
          {    
              return qint64(event->timestamp());
          }    
          return timer.elapsed();
      }
      
      void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
      {
          qint64 currentTimestamp = computeCurrentTime(event);
      
      ..........
                  qint64 elapsed = currentTimestamp - lastPosTime;
                  if (elapsed > 0)
                      addVelocitySample(diff / (qreal(elapsed) / 1000));
      ..........
      }

       

      Attachments

        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
            seokhako Seokha Ko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews