Simulating touchevents for QML
I'm currently trying to simulate some touch events which should be processed in a MouseArea item in QML. I create and send my touch events like
QTouchEvent::TouchPoint p(1); // the hardcoded touch id is just for testing
p.setScenePos(QPointF(pt.x, pt.y)); // pt is a simple point structure
QTouchEvent touchEvent(QEvent::TouchUpdate, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointMoved, touchPoints);
and also set
in a QmlApplicationViewer subclass' constructor, however the touches never get forwarded into QML code.
Am I something (touch-related) missing?
I finally figured it out, the touch events are not converted to click events in the GraphicsScene so I'm sending the click events manually too. The PinchArea however does receive my custom touch events, so the code is conceptually correct.