PDA

View Full Version : How to simulate touch event in Qt 3.1.2



Bairavi
28th August 2014, 09:29
Hello,
We have an UI application running in an embedded system which receives touch screen events. I would like to automate touch events in my application using another simple qt application which receives X and Y co-ordinates from the user.

Kindly help with some reference documents.

We tried the below code, no failures observed but it doesnt simulate the touch event.


QApplication a(argc, argv,QApplication::GuiServer);

QWSTslibMouseHandler *ptr;
ptr = (QWSTslibMouseHandler*)QWSServer::mouseHandler() ;
int x,y;
printf("\n Enter X co-ordinate :");
scanf("%d",&x);
printf("\n Enter Y co-ordinate :");
scanf("%d",&y);
QPoint q;
q.setX(x);
q.setY(y);
QPoint mousePos=q;
printf("\nBefore Emit..");
fflush(stdout);
emit ptr->mouseChanged(mousePos,Qt::LeftButton);
printf("\nAfter Emit..");
fflush(stdout);

Thanks in advance!!