[Interest] Simulating Mouse Click Event?

Mitchell Verter mitchell.verter at gmail.com
Wed Aug 21 18:39:44 CEST 2013


How do i simulate a mouse click event from a device that is not the mouse?

I can set the mouse position with a motion sensor.

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.
=========
MainWindow ....

void mouseMotionController()
{
....
if (mouse is in same position for a second)
{
printf("mouse is hovering");

 QMouseEvent * evt  = new QMouseEvent (
                          QEvent::MouseButtonPress,
                          pressPoint,
                          Qt::LeftButton,
                           Qt::LeftButton,
                          Qt::NoModifier);
 QCoreApplication::postEvent(this, evt);
}


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.

Any ideas?

Thanks
Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130821/c9395397/attachment.html>


More information about the Interest mailing list