void QTest::mouseClick ( QWidget * widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay = -1 )
Simulates clicking a mouse button with an optional modifier on a widget. The position of the click is defined by pos; the default position is the center of the widget. If delay is specified, the test will wait for the specified amount of milliseconds before pressing and before releasing the button.
文档如上,现在我想实现的是在屏幕特定坐标位置(该位置可以是任意一个未知的窗口)点击一下鼠标左键,但问题是这函数需要指定一个 QWidget,那该如何解决呢?比如我实际要点击的位置是一个浏览器,但现在它只能选择在QWidget上。