Hi ,
I'm trying to do an eye mouse controlled.
I want to simulate the click when the eye is closed.
I already have the cursor position. i'm having problems with the mouse click simulation.
I've tried this:
QTestEventList *eventos = new QTestEventList();
eventos->addMouseClick(Qt::LeftButton, 0, QPoint(x, y), -1);
eventos->simulate(this);
and this:
QTest::mouseClick(this, Qt::LeftButton, 0, QPoint(x, y), -1);
and:
QMouseEvent *p = new QMouseEvent(QEvent::MouseButtonPress, QPoint(x, y), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(this, p);
QMouseEvent *r = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(x, y), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(this, r);
Nothing works. I think it's because of the receiver, it's a QMainWindow. The thing is, I don't know in which button the mouse is over.
Thanks.
Bookmarks