Qt让鼠标自动点击
目前在做一个录制和播放的东西,就是录制屏幕上的鼠标和键盘事件,然后播放一遍,请问下,移动到指定的做标以后,鼠标怎么实现自动点击
[解决办法]
QPoint pos;
pos.setX(88);
pos.setY(58);
QMouseEvent *mEvnPress;
QMouseEvent *mEvnRelease;
mEvnPress = new QMouseEvent(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(QWidget::focusWidget(),mEvnPress);
mEvnRelease = new QMouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(QWidget::focusWidget(),mEvnRelease);