<div dir="ltr"><div>How do i simulate a mouse click event from a device that is not the mouse? <br><br>I can set the mouse position with a motion sensor. <br><br>Then I would like to send a Left Button Press after one second hover in aspot. However, none of the GUI elements are reacting to the event. <br>
=========<br></div>MainWindow ....<br><div><br></div><div>void mouseMotionController()<br></div><div>{<br>....<br>if (mouse is in same position for a second)<br>{<br>printf("mouse is hovering");<br><br> QMouseEvent * evt = new QMouseEvent (<br>
QEvent::MouseButtonPress,<br> pressPoint,<br> Qt::LeftButton,<br> Qt::LeftButton,<br> Qt::NoModifier);<br>
QCoreApplication::postEvent(this, evt);<br>}<br><br><br></div><div>I've tried a few permutations of this -- using qApp instead of QCoreApplication , using sendEvent instead of postEvent, using a QGraphicsSceneMouseEvent instead of a Mouse Event. But none of these seems to work.<br>
<br>Any ideas?<br><br>Thanks<br>Mitchell<br></div></div>