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

Synthetic mouse events marked as MouseEventNotSynthesized

    XMLWordPrintable

Details

    • 41293196b4db1aa7a0c616af312875c484639644

    Description

      When using QML inside a QQuickWidget, synthetic mouse events are synthesized by the operating system, when sliding a finger over a touch device. According to the documentation those mouse events shoud be marked with MouseEventSynthesizedBySystem. This is currently not the case when those events arrive at the QQuickItem within the QML scene, thereby making it difficult to differentiate between real and synthesized mouse events.

      Attached example reproduces it.
      Run the example and touch and slide green area, you can find that QQuickWidget prints

      MyQuickWidget::mousePressEvent QMouseEvent(MouseButtonPress, LeftButton,
      localPos=72,143, screenPos=778,256, MouseEventSynthesizedBySystem)
      Qt::MouseEventSource(MouseEventSynthesizedBySystem)

      same even when passed to Quickitem it looses its source as it can be seen in
      void QQuickWidget::mousePressEvent(QMouseEvent *e) that mapped event is not copying e-source()

      MyQuickItem::mousePressEvent QMouseEvent(MouseButtonPress, LeftButton,
      localPos=72,143, screenPos=778,256)
      Qt::MouseEventSource(MouseEventNotSynthesized)

      void QQuickWidget::mousePressEvent(QMouseEvent *e)
      {
          Q_D(QQuickWidget);
          Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMousePress, e->button(),
                                e->buttons());
      
          QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers());
          QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
          e->setAccepted(mappedEvent.isAccepted());
      }
      
      
      

      Attachments

        1. qtbug64241.zip
          7 kB
        2. qtbug64241.zip
          8 kB

        Issue Links

          Activity

            People

              srutledg Shawn Rutledge
              irfan.omair@digia.com Irfan Omair
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: