标题:如何模拟鼠标点击屏幕中某坐标?
作者:zhangxin5509
日期:2019-10-19 19:19
内容:
类似按键精灵中的鼠标点击。以下代码是从网上搜来的,运行后并没有效果。我的是苹果电脑,求大神指点谢谢~~
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);
#1 [20091001753 10-19 23:19]
https://blog.csdn.net/m32692529/article/details/78652089
#2 [liulin188 10-20 11:37]
用qt的不行,qt的那一套是只支持qt的
要用windows api
或者用第三方插件,比如大漠插件。
#3 回 20091001753 的帖子 [zhangxin5509 10-20 19:18]
20091001753:https://blog.csdn.net/m32692529/article/details/78652089 (2019-10-19 23:19)
这个代码看过了,无效,NULL是错误的
#4 回 liulin188 的帖子 [zhangxin5509 10-20 19:19]
liulin188:用qt的不行,qt的那一套是只支持qt的
要用windows api
或者用第三方插件,比如大漠插件。 (2019-10-20 11:37)
我支持mac吧?
#5 [zhangxin5509 10-23 22:24]
来人呀