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)
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,
|For Gerrit Dashboard: QTBUG-64241|
|210405,1||QQuickWidget: Propagate source of mouse events||5.9||qt/qtdeclarative||Status: ABANDONED||-1||0|
|213030,4||QQuickWidget: preserve QMouseEvent::source when mapping to the QQ window||5.9||qt/qtdeclarative||Status: MERGED||+2||0|
|213061,8||add tst_qquickwidget::synthMouseFromTouch test||5.9||qt/qtdeclarative||Status: MERGED||-2||0|